maths script (sums of integers to power n)

Job ID: 33355311

Budget: $30 – $250 USD

hello i need someone who i good at writing maths scripts
its a little technical so let me try to explain
i want to write a script to find the least number of integers, sqaures, cubes etc which sum to give another integer.
e.g every integer can be written as the sum of itself so thats trivial e.g take the number 35

as a sum of unit integers its just 35 obviously so answer is 1
as a sum of squares it can be written as 5^2 + 3^2 + 1^2 (25+9+1) i.e 3 squares
as a sum of cubes it can be written as 3^3 + 2^3 (27+8) i.e 2 cubes

eventually as we increase the power of n or the degree the number required will rise in general e.g if it was sums of powers of 5 it will be 2^5 + 1^5 + 1^5 + 1^5 = 4
powers of 6 it will be 1^6 + 1^6..... etc =35
so for powers of 6 or more it will take the full 35 as 1 is the only base which when raised to power of 6 or more is less than 35. 2^6 = 64 > 35 so not allowed.

as an extension i wanna make a grid to show the number of powers of n in column 1 then the numbers will be filled in each column from top to bottom let me show u an example for squares
note we only fill one number in each cell and move to the next column if the powers of n is less than or equal then the previous number
e,g 11 requires 3 squares and so does 12 but we write 12 in next column (same row)


powers of n is the first column used to count minimum squares required to give the number in the other columns

1 4 9 16 etc take 1 integer obviously as these are all squares
15 takes 4 as it is 3^2 + 2^2 + 1^2 + 1^2

1 1 4 9 16
2 2 5 8 10 13
3 3 6 11 12 14
4 7 15

Regards

we will make tables for other powers also

no time wasters
Related categories: PHP JavaScript Python Algorithm Mathematics