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

Published on 12 May 2024 09:40 PM

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

Source code in the quackery programming language

  $ "bigrat.qky" loadfile

  [ dup n->v 2 vsqrt
    drop 1 2 v+ / + ] is nonsquare ( n --> n )

  [ sqrt nip 0 = ]    is squarenum ( n --> b ) 

  say "Non-squares: "
  22 times [ i^ 1+ nonsquare echo sp ]
  cr cr
  0 
  999999 times 
    [ i^ 1+ nonsquare
      squarenum if 1+ ] 
  echo say " square numbers found"

  

You may also check:How to resolve the algorithm DNS query step by step in the Raku programming language
You may also check:How to resolve the algorithm Calculating the value of e step by step in the Free Pascal programming language
You may also check:How to resolve the algorithm Barnsley fern step by step in the Raku programming language
You may also check:How to resolve the algorithm Even or odd step by step in the TI-57 programming language
You may also check:How to resolve the algorithm DNS query step by step in the D programming language