How to resolve the algorithm Numbers which are not the sum of distinct squares step by step in the J programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Numbers which are not the sum of distinct squares step by step in the J programming language
Table of Contents
Problem Statement
Integer squares are the set of integers multiplied by themselves: 1 x 1 = 1, 2 × 2 = 4, 3 × 3 = 9, etc. ( 1, 4, 9, 16 ... ) Most positive integers can be generated as the sum of 1 or more distinct integer squares. Many can be generated in multiple ways: The number of positive integers that cannot be generated by any combination of distinct squares is in fact finite:
Find and show here, on this page, every positive integer than cannot be generated as the sum of distinct squares. Do not use magic numbers or pre-determined limits. Justify your answer mathematically.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Numbers which are not the sum of distinct squares step by step in the J programming language
Source code in the j programming language
task=: {{
r=. 'invalid'
lim=. 1
whilst. -.r -: have do.
have=. r
lim=. lim+1
r=. (i.*:lim) -. (#:i.2^lim)+/ .**:i.lim
end.
}}
task''
2 3 6 7 8 11 12 15 18 19 22 23 24 27 28 31 32 33 43 44 47 48 60 67 72 76 92 96 108 112 128
You may also check:How to resolve the algorithm GUI component interaction step by step in the FreeBASIC programming language
You may also check:How to resolve the algorithm Ethiopian multiplication step by step in the PHP programming language
You may also check:How to resolve the algorithm Loops/Continue step by step in the Scilab programming language
You may also check:How to resolve the algorithm Jump anywhere step by step in the VBA programming language
You may also check:How to resolve the algorithm Text processing/1 step by step in the Fortran programming language