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.

Showing 1-3 of 3 results.

A376993 a(n) = A376992(n) - 10^(n-1).

Original entry on oeis.org

4, 3, 13, 13, 513, 801, 6781, 30721, 40513, 1057513, 515313, 16728501, 78402181, 13617661, 472012281, 64846161, 5481873013, 2459693601, 116852093013, 62611784481, 1234170737761, 1565435686113, 17492477581161, 2254878102513, 16836143444113, 229959946206301
Offset: 1

Views

Author

Stefano Spezia, Oct 11 2024

Keywords

Crossrefs

Programs

  • Mathematica
    a[n_]:=(Module[{k=1}, While[!PrimeQ[m=2k^2+2k+1]||IntegerLength[m]
    				
  • Python
    from math import isqrt
    from itertools import count
    from sympy import isprime
    def A376993(n):
        for k in count(isqrt(((a:=10**(n-1))<<1)-1>>2)):
            m = 2*k*(k+1)+1
            if m >= a and isprime(m):
                return m-a # Chai Wah Wu, Oct 13 2024

Extensions

a(21)-a(26) from Chai Wah Wu, Oct 13 2024

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.

Original entry on oeis.org

-1, -1, 139, 1279, 15319, 102199, 1011079, 10054399, 100687891, 1000860859, 10004248351, 100048116199, 1000245990631, 10000171206199, 100000029166651, 1000000001958499, 10000010020185919, 100000022659152859, 1000000088358667051, 10000000476596855539, 100000000728055460899
Offset: 1

Views

Author

Jean-Marc Rebert, Oct 23 2024

Keywords

Comments

From Robert Israel, Dec 23 2024: (Start)
a(n) is the first n-digit prime, if any, in A027867.
a(n) == 1 or 19 (mod 30) if it is not -1. (End)

Examples

			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:
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.
		

Crossrefs

Programs

  • Maple
    f:= proc(n) local p,k;
     for k from ceil(sqrt(6*10^(n-1)-105)/6 - 5/2) do
       p:= 55 + 30*k + 6*k^2;
       if p >= 10^n then return -1 fi;
       if isprime(p) then return p fi;
      od
    end proc:
    f(1):= -1: f(2):= -1:
    map(f, [$1..25]); # Robert Israel, Dec 23 2024
  • Python
    from math import isqrt
    from sympy import isprime
    from itertools import count
    def f(m): return sum((m+i)**2 for i in range(6))
    def a(n):
        b = 10**(n-1)
        m = isqrt(b//6) - 5
        return next(t for i in count(m) if (t:=f(i)) >= b and isprime(t))
    print([a(n) for n in range(3, 23)]) # Michael S. Branicky, Oct 25 2024

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

Original entry on oeis.org

5, 29, 149, 1877, 11909, 100469, 1026677, 10013789, 100676549, 1000611509, 10007613149, 100003082789, 1000092600389, 10000275414869, 100000426365677, 1000004865589109, 10000013191662677, 100000034139489269, 1000000221045632669, 10000000313838962309, 100000002116695737029
Offset: 1

Views

Author

Jean-Marc Rebert, Oct 23 2024

Keywords

Examples

			29 is the smallest 2-digit prime number that can be expressed as the sum of the squares of three consecutive numbers. Specifically, the sum of the squares of the numbers from 2 to 4 is 29: Sum_{i=1..3} (1+i)^2 = 2^2 + 3^2 + 4^2 = 4 + 9 + 16 = 29.
		

Crossrefs

Primes in A120328.
Cf. A376992.

Programs

  • Python
    from math import isqrt
    from sympy import isprime
    from itertools import count
    def f(m): return sum((m+i)**2 for i in range(3))
    def a(n):
        b = 10**(n-1)
        m = isqrt(b//3) - 2
        m += m&1  # note: m must be even for f(m) to be odd
        return next(t for i in count(m, 2) if (t:=f(i)) >= b and isprime(t))
    print([a(n) for n in range(2, 22)]) # Michael S. Branicky, Oct 25 2024
Showing 1-3 of 3 results.