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!)
A057945 Number of triangular numbers needed to represent n with greedy algorithm. 13
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, 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, 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 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,3
COMMENTS
a(n) = sum of digits of A000462(n). - Reinhard Zumkeller, Mar 27 2011
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
LINKS
FORMULA
a(0)=0, otherwise a(n)=a(A002262(n))+1.
EXAMPLE
a(35)=3 since 35=28+6+1
MAPLE
A057945 := proc(n)
local a, x;
a := 0 ;
x := n ;
while x > 0 do
x := x-A057944(x) ;
a := a+1 ;
end do:
a ;
end proc: # R. J. Mathar, May 13 2016
MATHEMATICA
A057944[n_] := With[{k = Floor[Sqrt[8n+1]]}, Floor[(k-1)/2]* Floor[(k+1)/2]/2];
a[n_] := Module[{k = 0, x = n}, While[x>0, x = x - A057944[x]; k++]; k];
Table[a[n], {n, 0, 104}] (* Jean-François Alcover, Mar 10 2019, after R. J. Mathar *)
PROG
(Haskell)
a057945 n = g n $ reverse $ takeWhile (<= n) $ tail a000217_list where
g 0 _ = 0
g x (t:ts) = g r ts + a where (a, r) = divMod x t
-- Reinhard Zumkeller, Mar 27 2011
CROSSREFS
Cf. A000217, A002262, A056944, A057944. See A006893 for records.
Sequence in context: A023115 A194436 A061336 * A285730 A353655 A280055
KEYWORD
nonn
AUTHOR
Henry Bottomley, Oct 05 2000
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 April 19 19:02 EDT 2024. Contains 371798 sequences. (Running on oeis4.)