This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A057945 #16 Mar 10 2019 08:35:50 %S A057945 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 A057945 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 A057945 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 A057945 Number of triangular numbers needed to represent n with greedy algorithm. %C A057945 a(n) = sum of digits of A000462(n). - _Reinhard Zumkeller_, Mar 27 2011 %C A057945 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 A057945 Reinhard Zumkeller, <a href="/A057945/b057945.txt">Table of n, a(n) for n = 0..10000</a> %F A057945 a(0)=0, otherwise a(n)=a(A002262(n))+1. %e A057945 a(35)=3 since 35=28+6+1 %p A057945 A057945 := proc(n) %p A057945 local a,x; %p A057945 a := 0 ; %p A057945 x := n ; %p A057945 while x > 0 do %p A057945 x := x-A057944(x) ; %p A057945 a := a+1 ; %p A057945 end do: %p A057945 a ; %p A057945 end proc: # _R. J. Mathar_, May 13 2016 %t A057945 A057944[n_] := With[{k = Floor[Sqrt[8n+1]]}, Floor[(k-1)/2]* Floor[(k+1)/2]/2]; %t A057945 a[n_] := Module[{k = 0, x = n}, While[x>0, x = x - A057944[x]; k++]; k]; %t A057945 Table[a[n], {n, 0, 104}] (* _Jean-François Alcover_, Mar 10 2019, after _R. J. Mathar_ *) %o A057945 (Haskell) %o A057945 a057945 n = g n $ reverse $ takeWhile (<= n) $ tail a000217_list where %o A057945 g 0 _ = 0 %o A057945 g x (t:ts) = g r ts + a where (a,r) = divMod x t %o A057945 -- _Reinhard Zumkeller_, Mar 27 2011 %Y A057945 Cf. A000217, A002262, A056944, A057944. See A006893 for records. %K A057945 nonn %O A057945 0,3 %A A057945 _Henry Bottomley_, Oct 05 2000