A368570 Numbers k such that both k and k+1 are the sums of consecutive squares.
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
Keywords
Examples
85 = 6^2 + 7^2, and 86 = 3^2 + 4^2 + 5^2 + 6^2, so 85 is in the list.
Links
- Jon E. Schoenfield, Table of n, a(n) for n = 1..10000
- David A. Corneth, PARI program
- Jon E. Schoenfield, Magma program
Crossrefs
Cf. A034705.
Programs
-
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 *)
-
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
Extensions
More terms from Jon E. Schoenfield, 30 Dec 2023
Comments