login
a(n) = number of steps needed to reach zero when starting from k = (n^2)-1 and repeatedly applying the map that replaces k with k - A002828(k), where A002828(k) = the least number of squares that add up to k.
12

%I #12 Mar 30 2017 22:00:54

%S 0,1,3,5,9,13,18,23,30,37,44,52,62,71,81,91,104,117,131,144,159,174,

%T 190,207,224,243,262,281,301,321,343,365,388,412,437,461,487,514,539,

%U 567,596,625,654,684,715,748,781,814,848,883,918,955,991,1030,1067,1105,1145,1187,1227,1269,1311,1354,1396,1441,1486,1531,1579,1624,1673,1723,1773,1821

%N a(n) = number of steps needed to reach zero when starting from k = (n^2)-1 and repeatedly applying the map that replaces k with k - A002828(k), where A002828(k) = the least number of squares that add up to k.

%H Antti Karttunen, <a href="/A260733/b260733.txt">Table of n, a(n) for n = 1..1024</a>

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

%F a(n) = A260732(n)-1.

%t Table[Length[#] - 2 &@ NestWhileList[# - (If[First@ # > 0, 1, Length[ First@ Split@ #] + 1] &@ SquaresR[Range@ 4, #]) &, n^2, # != 0 &], {n, 72}] (* _Michael De Vlieger_, Sep 08 2016 *)

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

%o (definec (A260733 n) (if (= 1 n) 0 (+ (A260734 (- n 1)) (A260733 (- n 1)))))

%o (define (A260733 n) (A260731 (- (* n n) 1)))

%Y One less than A260732.

%Y Cf. A002828, A255131, A260731, A260734.

%Y Cf. also A261223.

%K nonn

%O 1,3

%A _Antti Karttunen_, Aug 12 2015