The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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 (list; graph; refs; listen; history; text; internal format)
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.
LINKS
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}
CROSSREFS
Sequence in context: A063274 A274459 A225926 * A351064 A339822 A194063
KEYWORD
nonn
AUTHOR
Peter Schorn, Jun 06 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 21 10:20 EDT 2024. Contains 372735 sequences. (Running on oeis4.)