OFFSET
1,2
COMMENTS
For each integer n one can define smallest-next-square function S(n) such that S(n) is a perfect square, S(n) >=n, and such that S(n)-n is also a perfect square. If there are more such S(n), take the smallest, use -1 if this S(n) does not exist.
This S(n) starts for n>=0 as 0, 1, -1, 4, 4, 9, -1, 16, 9, 9, -1, 36, 16, 49, -1, 16, 16, 81,...
The locations of the -1 are in A016825.
The quadrisection S(4n) is S(0)=0, S(4)=4, S(8)=9, S(12)=16, S(16)=16, S(20)=36, S(24)=25, S(28)=64.
The sequence shows the arguments 4n of this quadrisection for which S(4n) is not larger than any S(4n') for n'>n.
Evidently, the sequence is a subsequence of A008586.
EXAMPLE
S(20) =36 is larger than S(24), so 20 is not in the sequence. S(28)=64 is larger than S(32)=36, so 28 is not in the sequence.
MAPLE
nxtSqr := proc(n) local d, y, x ; for d in sort(convert(numtheory[divisors](n), list)) do if d >= n/d then y := (d+n/d)/2 ; if type(y, 'integer') then x := d-y ; if n+x^2 = y^2 then return y^2 ; end if; end if; end if; end do: return -1 ; end proc:
isA172412 := proc(n) local y2; if n mod 4 = 0 then y2 := nxtSqr(n) ; for a from n+4 by 4 do if a > y2 then return true; elif nxtSqr(a) < y2 then return false; end if; end do: else false; end if; end proc:
for n from 0 to 500 by 4 do if isA172412(n) then printf("%d, ", n); end if; end do:
CROSSREFS
KEYWORD
nonn
AUTHOR
Paul Curtz, Nov 20 2010
STATUS
approved