|
|
A368570
|
|
Numbers k such that both k and k+1 are the sums of consecutive squares.
|
|
3
|
|
|
0, 4, 13, 29, 49, 54, 85, 90, 139, 144, 203, 255, 284, 365, 384, 505, 509, 649, 676, 728, 729, 818, 924, 960, 1013, 1014, 1201, 1210, 1225, 1239, 1454, 1495, 1784, 1854, 2108, 2214, 2469, 2665, 2779, 2813, 2814, 2869, 3025, 3135, 3309, 3310, 3794, 4230, 4323, 4324, 4705
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
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
|
|
|
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]];
|
|
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))
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|