login
a(n) = the number of squared primes and 1's needed to sum to n.
4

%I #10 Mar 06 2021 11:56:06

%S 1,2,3,1,2,3,4,2,1,2,3,3,2,3,4,4,3,2,3,4,4,3,4,5,1,2,3,4,2,3,4,5,3,2,

%T 3,4,4,3,4,5,5,4,3,4,5,5,4,5,1,2,3,4,2,3,4,5,3,2,3,4,4,3,4,5,5,4,3,4,

%U 5,5,4,5,6,2,3,4,5,3,4,5,6,4,3,4,5,5,4,5,6,6,5,4,5,6,6,5,6,2,3,4,5,3,4,5,6

%N a(n) = the number of squared primes and 1's needed to sum to n.

%C a(n) has a new maximum at n=1,2,3,7,24,73,266,795.

%C I suspect that a(n) <= 9 for all n. - _Robert G. Wilson v_, Sep 18 2004

%H Nicholas Matteo, <a href="/A096436/b096436.txt">Table of n, a(n) for n = 1..10000</a>

%e a(5) = 2 because 5=4+1.

%e a(17) = 3 because 17=9+4+4.

%e A number may have many such sums: 27=25+1+1=9+9+9, 50=25+25=49+1.

%t f[n_] := Block[{d = n, k = PrimePi[ Sqrt[n]], sp = {}}, While[d > 3, While[p = Prime[k]; d >= p^2, AppendTo[sp, p]; d = d - p^2]; k-- ]; While[d != 0, AppendTo[sp, 1]; d = d - 1]; If[Position[sp, 3] != {} && sp[[ -3]] == 1, sp = Delete[Drop[sp, -3], Position[sp, 3][[1]]]; AppendTo[sp, {2, 2, 2}]]; Reverse[ Sort[ Flatten[ sp]]]]; Table[ Length[ f[n]], {n, 105}] (* _Robert G. Wilson v_, Sep 20 2004 *)

%Y Cf. A001248, A002828, A045698, A051034, A063274.

%K nonn,easy

%O 1,2

%A Tom Raes (tommy1729(AT)hotmail.com), Aug 10 2004

%E Edited and extended by _Robert G. Wilson v_, Sep 18 2004

%E Edited by _Don Reble_, Apr 23 2006