This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A057945 Number of triangular numbers needed to represent n with greedy algorithm. 8

%I

%S 0,1,2,1,2,3,1,2,3,2,1,2,3,2,3,1,2,3,2,3,4,1,2,3,2,3,4,2,1,2,3,2,3,4,

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

%U 3,2,3,4,2,3,4,3,2,3,1,2,3,2,3,4,2,3,4,3,2,3,4,1,2,3,2,3,4,2,3,4,3,2,3,4,3

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

%C a(n) = sum of digits of A000462(n). - _Reinhard Zumkeller_, Mar 27 2011

%C The length of (number of moves in) Simon Norton's game in A006019 starting with an initial heap of n if both players always take, never put. - _R. J. Mathar_, May 13 2016

%H Reinhard Zumkeller, <a href="/A057945/b057945.txt">Table of n, a(n) for n = 0..10000</a>

%F a(0)=0, otherwise a(n)=a(A002262(n))+1.

%e a(35)=3 since 35=28+6+1

%p A057945 := proc(n)

%p local a,x;

%p a := 0 ;

%p x := n ;

%p while x > 0 do

%p x := x-A057944(x) ;

%p a := a+1 ;

%p end do:

%p a ;

%p end proc: # _R. J. Mathar_, May 13 2016

%t A057944[n_] := With[{k = Floor[Sqrt[8n+1]]}, Floor[(k-1)/2]* Floor[(k+1)/2]/2];

%t a[n_] := Module[{k = 0, x = n}, While[x>0, x = x - A057944[x]; k++]; k];

%t Table[a[n], {n, 0, 104}] (* _Jean-François Alcover_, Mar 10 2019, after _R. J. Mathar_ *)

%o a057945 n = g n \$ reverse \$ takeWhile (<= n) \$ tail a000217_list where

%o g 0 _ = 0

%o g x (t:ts) = g r ts + a where (a,r) = divMod x t

%o -- _Reinhard Zumkeller_, Mar 27 2011

%Y Cf. A000217, A002262, A056944, A057944. See A006893 for records.

%K nonn

%O 0,3

%A _Henry Bottomley_, Oct 05 2000

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

Last modified September 15 14:04 EDT 2019. Contains 327078 sequences. (Running on oeis4.)