login
A354761
Least number of squares and cubes that add up to n.
0
1, 2, 3, 1, 2, 3, 4, 1, 1, 2, 3, 2, 2, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 1, 2, 1, 2, 2, 3, 2, 2, 2, 2, 2, 1, 2, 3, 3, 2, 2, 3, 2, 2, 2, 3, 3, 3, 1, 2, 3, 2, 2, 2, 3, 3, 2, 2, 3, 3, 2, 3, 2, 1, 2, 3, 3, 2, 3, 3, 3, 2, 2, 2, 3, 2, 3, 3, 3, 2, 1, 2, 3, 3, 2, 3
OFFSET
1,2
COMMENTS
a(n) <= 4 since any number can be written as a sum of 4 squares (Lagrange's theorem).
Sequence first differs from A063274, A225926 and A274459 at n = 32 since 32 is a powerful number, a prime power and a perfect power but neither a square nor a cube.
EXAMPLE
a(1) = 1, a(4) = 1 (4 = 2^2), a(7) = 4 (7 = 2^2 + 1^2 + 1^2 + 1^2), a(8) = 1 (8 = 2^3), a(12) = 2 (12 = 2^3 + 2^2), a(17) = 2 (17 = 4^2 + 1^2), a(32) = 2 (32 = 4^2 + 4^2).
PROG
(PARI) lista(n) = {my(v = vector(n)); for(j = 2, 3, for(i = 2, sqrtnint(n, j), v[i^j] = 1)); v[1]=1; v[2]=2; for(i=3, #v, if(v[i]==0, v[i] = vecmin(vector(i\2, k, v[k] + v[i-k])))); v}
KEYWORD
nonn
AUTHOR
Peter Schorn, Jun 06 2022
STATUS
approved