login
a(n) = number of steps needed to reach (n^2)-1 when starting from k = ((n+1)^2)-1 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 #16 Mar 30 2017 21:57:06

%S 1,2,2,3,3,3,4,5,5,6,6,7,7,7,8,8,9,10,10,11,11,12,12,12,13,13,14,14,

%T 15,15,16,17,17,18,18,19,19,19,20,21,21,21,22,22,23,23,24,24,25,26,26,

%U 27,27,28,28,28,29,30,30,31,31,31,32,32,33,33,34,34,35,35,36,37,37,38,38,39,39,39,40,41,41,42,42,42,43,43,44,44,45,45,46

%N a(n) = number of steps needed to reach (n^2)-1 when starting from k = ((n+1)^2)-1 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="/A261224/b261224.txt">Table of n, a(n) for n = 1..6000</a>

%F a(n) = A261221(((n+1)^2)-1) - A261221((n^2)-1). [The definition.]

%F Equally, for all n >= 1:

%F a(n) = A261221((n+1)^2) - A261221(n^2).

%F a(n) = A261222(n+1) - A261222(n).

%F a(n) = A261223(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 + 1)^2) - 1, # != n^2 - 1 &], {n, 91}] (* _Michael De Vlieger_, Sep 08 2016, after _Jud McCranie_ at A053610 *)

%o (Scheme, three variants, the first one utilizing memoization-macro definec)

%o (definec (A261224 n) (let ((end (- (A000290 n) 1))) (let loop ((k (- (A000290 (+ 1 n)) 1)) (s 0)) (if (= k end) s (loop (A260740 k) (+ 1 s))))))

%o (define (A261224 n) (- (A261223 (+ 1 n)) (A261223 n)))

%o (define (A261224 n) (- (A261221 (A000290 (+ 1 n))) (A261221 (A000290 n))))

%Y First differences of both A261222 and A261223.

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

%Y Cf. also A260734, A261229.

%K nonn

%O 1,2

%A _Antti Karttunen_, Aug 12 2015