login
a(n) = number of steps to reach 0 when starting from k = n*n and repeatedly applying the map that replaces k with k - A053610(k), where A053610(k) = the number of positive squares that sum to k using the greedy algorithm.
9

%I #13 Mar 30 2017 21:57:56

%S 0,1,2,4,6,9,12,15,19,24,29,35,41,48,55,62,70,78,87,97,107,118,129,

%T 141,153,165,178,191,205,219,234,249,265,282,299,317,335,354,373,392,

%U 412,433,454,475,497,519,542,565,589,613,638,664,690,717,744,772,800,828,857,887,917,948,979,1010,1042,1074,1107,1140,1174,1208,1243,1278,1314,1351,1388,1426,1464,1503

%N a(n) = number of steps to reach 0 when starting from k = n*n and repeatedly applying the map that replaces k with k - A053610(k), where A053610(k) = the number of positive squares that sum to k using the greedy algorithm.

%H Antti Karttunen, <a href="/A261222/b261222.txt">Table of n, a(n) for n = 0..6000</a>

%F a(n) = A261221(n^2).

%F Other identities. For all n >= 1:

%F a(n) = 1 + A261223(n).

%t Table[-1 + Length@ NestWhileList[# - Block[{m = #, c = 1}, While[a = (# - Floor[Sqrt@ #]^2) &@ m; a != 0, c++; m = a]; c] &, n^2, # != 0 &], {n, 0, 77}] (* _Michael De Vlieger_, Sep 08 2016, after _Jud McCranie_ at A053610 *)

%o (Scheme, two variants, the other one using memoization-macro definec)

%o (definec (A261222 n) (if (<= n 1) n (+ (A261224 (- n 1)) (A261222 (- n 1)))))

%o (define (A261222 n) (A261221 (* n n)))

%Y Essentially one more than A261223.

%Y First differences: A261224.

%Y Cf. A000290, A053610, A260740, A261221.

%Y Cf. also A260732, A261227.

%K nonn

%O 0,3

%A _Antti Karttunen_, Aug 12 2015