OFFSET
1,2
COMMENTS
A subsequence of A034705, identifying the lower of each pair of consecutive integers belonging to that sequence.
Similarly, two consecutive integers in this sequence, a(n+1) = a(n)+1, such as 1013 and 1014, or 3309 and 3310, correspond to three consecutive integers in A034705, and so on. - M. F. Hasler, Jan 02 2024
LINKS
Jon E. Schoenfield, Table of n, a(n) for n = 1..10000
David A. Corneth, PARI program
Jon E. Schoenfield, Magma program
EXAMPLE
85 = 6^2 + 7^2, and 86 = 3^2 + 4^2 + 5^2 + 6^2, so 85 is in the list.
MATHEMATICA
a[n_] := Module[{v, r = {}, s = 1, t, ul = 100, pr = 1}, While[Length[r] < n, v = ConstantArray[0, ul + 1]; Do[t = 0; Do[t += j^2; If[t <= ul + 1, v[[t]] = 1, Break[]], {j, i, 1, -1}], {i, 1, Sqrt[ul + 1]}]; Do[If[v[[i]] == 1, s++; If[s >= 2 && Not[MemberQ[r, i - 1]], AppendTo[r, i - 1]], s = 0], {i, pr, ul + 1}]; pr = ul + 1; ul *= 2; ]; Take[r, n]];
a[49] (* Robert P. P. McKone, Dec 30 2023 *)
PROG
(PARI) \\ See PARI link
(Python)
import heapq
from itertools import islice
def agen(): # generator of terms
m = 0; h = [(m, 0, 0)]; nextcount = 1; v1 = -2
while True:
(v, s, l) = heapq.heappop(h)
if v != v1:
if v1 + 1 == v: yield v1
v1 = v
if v >= m:
m += nextcount*nextcount
heapq.heappush(h, (m, 1, nextcount))
nextcount += 1
v -= s*s; s += 1; l += 1; v += l*l
heapq.heappush(h, (v, s, l))
print(list(islice(agen(), 51))) # Michael S. Branicky, Jan 01 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Allan C. Wechsler, Dec 30 2023
EXTENSIONS
More terms from Jon E. Schoenfield, 30 Dec 2023
STATUS
approved