How to resolve the algorithm Sequence of non-squares step by step in the PicoLisp programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Sequence of non-squares step by step in the PicoLisp programming language

Table of Contents

Problem Statement

Show that the following remarkable formula gives the sequence of non-square natural numbers:

This is sequence   A000037   in the OEIS database.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Sequence of non-squares step by step in the PicoLisp programming language

Source code in the picolisp programming language

(de sqfun (N)
   (+ N (sqrt N T)) )  # 'sqrt' rounds when called with 'T'

(for I 22
   (println I (sqfun I)) )

(for I 1000000
   (let (N (sqfun I)  R (sqrt N))
      (when (= N (* R R))
         (prinl N " is square") ) ) )

  

You may also check:How to resolve the algorithm Averages/Arithmetic mean step by step in the AWK programming language
You may also check:How to resolve the algorithm Sutherland-Hodgman polygon clipping step by step in the JavaScript programming language
You may also check:How to resolve the algorithm Remove lines from a file step by step in the Haskell programming language
You may also check:How to resolve the algorithm Euler's constant 0.5772... step by step in the Mathematica/Wolfram Language programming language
You may also check:How to resolve the algorithm Update a configuration file step by step in the Racket programming language