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.

A360061 Lexicographically earliest increasing sequence such that a(1) = 2 and for n >= 2, a(1)^2 + a(2)^2 + ... + a(n)^2 is a prime.

This page as a plain text file.
%I A360061 #37 Feb 03 2025 09:37:03
%S A360061 2,3,4,12,48,54,66,138,144,162,168,180,198,234,252,264,330,360,366,
%T A360061 372,402,420,444,462,480,534,546,552,564,576,600,630,642,678,702,744,
%U A360061 756,846,852,858,882,966,1008,1206,1242,1254,1266,1272,1296,1302,1338,1650
%N A360061 Lexicographically earliest increasing sequence such that a(1) = 2 and for n >= 2, a(1)^2 + a(2)^2 + ... + a(n)^2 is a prime.
%e A360061 For n >= 2, partial sums of squares are (showing primality): 2^2 + 3^2 = 13; 13 + 4^2 = 29; 29 + 12^2 = 173; 173 + 48^2 = 2477; ...
%p A360061 s:= proc(n) option remember; `if`(n<1, 0, a(n)^2+s(n-1)) end:
%p A360061 a:= proc(n) option remember; local k, m;
%p A360061       k:= s(n-1); for m from 1+a(n-1)
%p A360061       while not isprime(k+m^2) do od; m
%p A360061     end: a(1):=2:
%p A360061 seq(a(n), n=1..52);  # _Alois P. Heinz_, Jan 26 2023
%t A360061 s[n_] := s[n] = If[n < 1, 0, a[n]^2 + s[n-1]];
%t A360061 a[n_] := a[n] = Module[{k, m},
%t A360061    k = s[n-1]; For[m = 1 + a[n-1],
%t A360061    !PrimeQ[k + m^2], m++]; m];
%t A360061 a[1] = 2;
%t A360061 Table[a[n], {n, 1, 52}] (* _Jean-François Alcover_, Feb 03 2025, after _Alois P. Heinz_ *)
%o A360061 (Haskell)
%o A360061 import Math.NumberTheory.Primes.Testing (isPrime)
%o A360061 a360061_list = 2 : 3 : recurse 4 13 where
%o A360061   recurse n p
%o A360061     | isPrime(n^2 + p) = n : recurse (n+1) (n^2 + p)
%o A360061     | otherwise        = recurse (n+1) p
%o A360061 -- _Peter Kagey_, Jan 25 2023
%Y A360061 Cf. A051935, A137326.
%K A360061 easy,nonn
%O A360061 1,1
%A A360061 _Win Wang_, Jan 23 2023