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

Published on 12 May 2024 09:40 PM
#K

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

Source code in the k programming language

   nonsquare:{x+_.5+%x}
   nonsquare[1_!23]


   issquare:{(%x)=_%x}
   +/issquare[nonsquare[1_!1000001]]  / Number of squares in first million results


  

You may also check:How to resolve the algorithm Naming conventions step by step in the Tcl programming language
You may also check:How to resolve the algorithm Golden ratio/Convergence step by step in the ALGOL W programming language
You may also check:How to resolve the algorithm Emirp primes step by step in the Maple programming language
You may also check:How to resolve the algorithm String comparison step by step in the Lua programming language
You may also check:How to resolve the algorithm Perfect numbers step by step in the SASL programming language