cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A238489 Numbers k such that k+x+y is a square, where x and y are the two squares nearest to k.

This page as a plain text file.
%I A238489 #26 Apr 24 2022 19:21:22
%S A238489 0,4,11,23,56,80,103,135,204,248,339,395,444,508,576,635,711,860,948,
%T A238489 1119,1219,1304,1412,1619,1739,1968,2100,2211,2351,2495,2616,2768,
%U A238489 3055,3219,3528,3704,3851,4035,4223,4380,4576,4943,5151,5540,5760,5943,6171,6596,6836,7283
%N A238489 Numbers k such that k+x+y is a square, where x and y are the two squares nearest to k.
%C A238489 If k is a square then y=k.
%C A238489 The sequence of terms that are perfect squares begins: 0, 4, 576, 108900, 21086464, 4090114116, 793453377600.
%C A238489 In other words, numbers x such that x + 2y(y+1) = z^2 has a solution with x in the interval [y^2+1, (y+1)^2], see Sage program. - _Ralf Stephan_, Mar 09 2014
%C A238489 The nonzero terms which are perfect squares are exactly the squares of A081065. - _Ivan Neretin_, Jun 25 2015
%H A238489 Harvey P. Dale, <a href="/A238489/b238489.txt">Table of n, a(n) for n = 1..500</a>
%e A238489 The two squares nearest to 4 are 1 and 4. Because 4+1+4=9 is a square, 4 is in the sequence.
%e A238489 The two squares nearest to 11 are 9 and 16. Because 11+9+16=36 is a square, 11 is in the sequence.
%t A238489 kxyQ[n_]:=Module[{c=Floor[Sqrt[n]]},IntegerQ[Sqrt[n+Total[Nearest[Range[c-2, c+2]^2,n,2]]]]]; Join[{0},Select[Range[3,7500],kxyQ]] (* _Harvey P. Dale_, Apr 24 2022 *)
%o A238489 (Python) # use version >= 3.8
%o A238489 from math import isqrt
%o A238489 for k in range(7777):
%o A238489     s = isqrt(k)
%o A238489     if s*s==k:  s-=1
%o A238489     kxy = k + 2*s*(s+1) + 1   # k + s^2 + (s+1)^2
%o A238489     r = isqrt(kxy)
%o A238489     if r*r==kxy:  print(str(k), end=',')
%o A238489 (Sage)
%o A238489 def gen_a():
%o A238489     n = 1
%o A238489     while True:
%o A238489         for t in range(n*n + 1, n*n + 2*n + 2):
%o A238489             if is_square(t + 2*(n*n + n) + 1):
%o A238489                 yield t
%o A238489     n += 1              # _Ralf Stephan_, Mar 09 2014
%Y A238489 Cf. A000290, A238456.
%K A238489 nonn
%O A238489 1,2
%A A238489 _Alex Ratushnyak_, Feb 27 2014