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.

A377295 a(n) is the least n-digit prime which is the sum of the squares of six consecutive nonnegative numbers, or -1 if no such prime exists.

This page as a plain text file.
%I A377295 #27 Dec 23 2024 21:58:22
%S A377295 -1,-1,139,1279,15319,102199,1011079,10054399,100687891,1000860859,
%T A377295 10004248351,100048116199,1000245990631,10000171206199,
%U A377295 100000029166651,1000000001958499,10000010020185919,100000022659152859,1000000088358667051,10000000476596855539,100000000728055460899
%N A377295 a(n) is the least n-digit prime which is the sum of the squares of six consecutive nonnegative numbers, or -1 if no such prime exists.
%C A377295 From _Robert Israel_, Dec 23 2024: (Start)
%C A377295 a(n) is the first n-digit prime, if any, in A027867.
%C A377295 a(n) == 1 or 19 (mod 30) if it is not -1. (End)
%H A377295 Robert Israel, <a href="/A377295/b377295.txt">Table of n, a(n) for n = 1..996</a>
%e A377295 139 is the smallest 3-digit prime number that can be expressed as the sum of the squares of six consecutive numbers. Specifically, the sum of the squares of the numbers from 2 to 7 is 139:
%e A377295 Sum_{i=1..6} (1+i)^2 = 2^2 + 3^2 + 4^2 + 5^2 + 6^2 + 7^2 = 4 + 9 + 16 + 25 + 36 + 49 = 139.
%p A377295 f:= proc(n) local p,k;
%p A377295  for k from ceil(sqrt(6*10^(n-1)-105)/6 - 5/2) do
%p A377295    p:= 55 + 30*k + 6*k^2;
%p A377295    if p >= 10^n then return -1 fi;
%p A377295    if isprime(p) then return p fi;
%p A377295   od
%p A377295 end proc:
%p A377295 f(1):= -1: f(2):= -1:
%p A377295 map(f, [$1..25]); # _Robert Israel_, Dec 23 2024
%o A377295 (Python)
%o A377295 from math import isqrt
%o A377295 from sympy import isprime
%o A377295 from itertools import count
%o A377295 def f(m): return sum((m+i)**2 for i in range(6))
%o A377295 def a(n):
%o A377295     b = 10**(n-1)
%o A377295     m = isqrt(b//6) - 5
%o A377295     return next(t for i in count(m) if (t:=f(i)) >= b and isprime(t))
%o A377295 print([a(n) for n in range(3, 23)]) # _Michael S. Branicky_, Oct 25 2024
%Y A377295 Cf. A027865, A027867, A376992.
%K A377295 sign,base
%O A377295 1,3
%A A377295 _Jean-Marc Rebert_, Oct 23 2024