How to resolve the algorithm Sequence of non-squares step by step in the APL programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Sequence of non-squares step by step in the APL 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 APL programming language
Source code in the apl programming language
NONSQUARE←{(⍳⍵)+⌊0.5+(⍳⍵)*0.5}
NONSQUARE 22
2 3 5 6 7 8 10 11 12 13 14 15 17 18 19 20 21 22 23 24 26 27
HOWMANYSQUARES←{+⌿⍵=(⌊⍵*0.5)*2}
HOWMANYSQUARES NONSQUARE 1000000
0
You may also check:How to resolve the algorithm Sorting algorithms/Heapsort step by step in the Dart programming language
You may also check:How to resolve the algorithm Hofstadter Figure-Figure sequences step by step in the JavaScript programming language
You may also check:How to resolve the algorithm Pig the dice game/Player step by step in the Nim programming language
You may also check:How to resolve the algorithm Nim game step by step in the Arturo programming language
You may also check:How to resolve the algorithm Time a function step by step in the Rust programming language