login
Number of pentagonal numbers needed to represent n with greedy algorithm.
2

%I #9 Apr 22 2021 04:07:21

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

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

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

%N Number of pentagonal numbers needed to represent n with greedy algorithm.

%C Sequence is unbounded.

%H Andrew Howroyd, <a href="/A145172/b145172.txt">Table of n, a(n) for n = 1..10000</a>

%e a(21)=6 since 21 = 12+5+1+1+1+1.

%o (PARI) a(n)={my(s=0); forstep(k=(sqrtint(24*n+1)+1)\6, 1, -1, my(t=k*(3*k-1)/2); s+=n\t; n%=t); s} \\ _Andrew Howroyd_, Apr 21 2021

%Y Cf. A000326 (pentagonal numbers), A053610, A057945, A180447, A192988.

%K nonn

%O 1,2

%A Christina Steffan (christina.steffan(AT)gmx.at), Oct 03 2008

%E Terms a(41) and beyond from _Andrew Howroyd_, Apr 21 2021