login
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
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
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
(PARI) is_A368570(n)=is_A034705(n)&&is_A034705(n+1) \\ M. F. Hasler, Jan 02 2024
(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
Cf. A034705.
Sequence in context: A155387 A155366 A340002 * A135039 A168559 A212247
KEYWORD
nonn
AUTHOR
Allan C. Wechsler, Dec 30 2023
EXTENSIONS
More terms from Jon E. Schoenfield, 30 Dec 2023
STATUS
approved