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.

A368570 Numbers k such that both k and k+1 are the sums of consecutive squares.

This page as a plain text file.
%I A368570 #36 Mar 18 2024 03:01:49
%S A368570 0,4,13,29,49,54,85,90,139,144,203,255,284,365,384,505,509,649,676,
%T A368570 728,729,818,924,960,1013,1014,1201,1210,1225,1239,1454,1495,1784,
%U A368570 1854,2108,2214,2469,2665,2779,2813,2814,2869,3025,3135,3309,3310,3794,4230,4323,4324,4705
%N A368570 Numbers k such that both k and k+1 are the sums of consecutive squares.
%C A368570 A subsequence of A034705, identifying the lower of each pair of consecutive integers belonging to that sequence.
%C A368570 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
%H A368570 Jon E. Schoenfield, <a href="/A368570/b368570.txt">Table of n, a(n) for n = 1..10000</a>
%H A368570 David A. Corneth, <a href="/A368570/a368570.gp.txt">PARI program</a>
%H A368570 Jon E. Schoenfield, <a href="/A368570/a368570.txt">Magma program</a>
%e A368570 85 = 6^2 + 7^2, and 86 = 3^2 + 4^2 + 5^2 + 6^2, so 85 is in the list.
%t A368570 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]];
%t A368570 a[49] (* _Robert P. P. McKone_, Dec 30 2023 *)
%o A368570 (PARI) \\ See PARI link
%o A368570 (PARI) is_A368570(n)=is_A034705(n)&&is_A034705(n+1) \\ _M. F. Hasler_, Jan 02 2024
%o A368570 (Python)
%o A368570 import heapq
%o A368570 from itertools import islice
%o A368570 def agen(): # generator of terms
%o A368570     m = 0; h = [(m, 0, 0)]; nextcount = 1; v1 = -2
%o A368570     while True:
%o A368570         (v, s, l) = heapq.heappop(h)
%o A368570         if v != v1:
%o A368570             if v1 + 1 == v: yield v1
%o A368570             v1 = v
%o A368570         if v >= m:
%o A368570             m += nextcount*nextcount
%o A368570             heapq.heappush(h, (m, 1, nextcount))
%o A368570             nextcount += 1
%o A368570         v -= s*s; s += 1; l += 1; v += l*l
%o A368570         heapq.heappush(h, (v, s, l))
%o A368570 print(list(islice(agen(), 51))) # _Michael S. Branicky_, Jan 01 2024
%Y A368570 Cf. A034705.
%K A368570 nonn
%O A368570 1,2
%A A368570 _Allan C. Wechsler_, Dec 30 2023
%E A368570 More terms from _Jon E. Schoenfield_, 30 Dec 2023