login
Index of first occurrence of n in A280053, the nachos numbers based on squares.
3

%I #13 Jan 30 2017 12:04:30

%S 1,2,3,4,9,23,53,193,1012,11428,414069,89236803,281079668014,

%T 49673575524946259,3690344289594918623401179,

%U 2363083530686659576336864121757607550,1210869542685904980187672572977511794639836071291151196

%N Index of first occurrence of n in A280053, the nachos numbers based on squares.

%C Analysis from _Lars Blomberg_, Jan 08 2017 (Start)

%C Consider the sequence of sums of squares, q(n), n=1,2,3,... (A000330):

%C 1, 5, 14, 30, 55, 91, 140, 204, 285, 385, 506, 650, 819, 1015, 1240, 1496, ...

%C which has formula q(n) = n*(n+1)*(2*n+1)/6.

%C The term A280053(x) can be computed by repeatedly subtracting the largest q(n)<=x from x until 0 is reached. For example, 8 = 5+1+1+1, so A280053(8)=4

%C Note that A280054 is strictly increasing. Let r be the last term so far in A280054, and s the next term. We must find the smallest term in q such that s-q(n-1) = r, or s=q(n-1)+r. Therefore s will have one more phase than r, and it will be the smallest possible s.

%C We also require that s<q(n), otherwise we must pick a larger n. In other words, r must be less than the interval between q(n-1) and q(n), that is r < q(n-1)-q(n) = n^2

%C Calculate n=floor(sqrt(r))+1 and from this we get s=q(n-1)+r.

%C Note that the q sequence need not be explicitly calculated and stored.

%C Examples:

%C r.........n....q(n-1).......q(n)........s..phases

%C 4.........3.........5........14.........9.......5

%C 9.........4........14........30........23.......6

%C 23........5........30........55........53.......7

%C 53........8.......140.......204.......193.......8

%C 193......14.......819......1015......1012.......9

%C 1012.....32.....10416.....11440.....11428......10

%C 11428...107....402641....414090....414069......11

%C 414069..644..88822734..89237470..89236803......12

%C ...

%C The above values were confirmed by direct calculation.

%C (End)

%H Lars Blomberg, <a href="/A280054/b280054.txt">Table of n, a(n) for n = 1..24</a>

%Y Cf. A280053.

%K nonn

%O 1,2

%A _N. J. A. Sloane_, Jan 07 2017

%E More terms from _Lars Blomberg_, Jan 08 2017