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

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Sequence of non-squares step by step in the Liberty BASIC 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 Liberty BASIC programming language

Source code in the liberty programming language

for i = 1 to 22
    print nonsqr( i); " ";
next i
print

found = 0
for i = 1 to 1000000
     j = ( nonsqr( i))^0.5
     if j = int( j) then
        found = 1
        print "Found square: "; i
        exit for
     end if
next i
if found =0 then print "No squares found"

end

function nonsqr( n)
    nonsqr = n +int( 0.5 +n^0.5)
end function

  

You may also check:How to resolve the algorithm Look-and-say sequence step by step in the JavaScript programming language
You may also check:How to resolve the algorithm Terminal control/Display an extended character step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Chowla numbers step by step in the Kotlin programming language
You may also check:How to resolve the algorithm Palindrome detection step by step in the Julia programming language
You may also check:How to resolve the algorithm Quine step by step in the HTML programming language