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.

A347977 Primes of the form 2^p * 3^q * 5^r * 7^s - 1.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 41, 47, 53, 59, 71, 79, 83, 89, 97, 107, 127, 139, 149, 167, 179, 191, 199, 223, 239, 251, 269, 293, 349, 359, 383, 419, 431, 449, 479, 499, 503, 587, 599, 647, 719, 809, 839, 863, 881, 971, 1049, 1151, 1249, 1259, 1279, 1399, 1439, 1499, 1511, 1567, 1619, 1889
Offset: 1

Views

Author

Flávio V. Fernandes, Sep 21 2021

Keywords

Comments

Restricting to r = s = 0 gives A005105; s = 0 gives A293194.
Primes of the form A002473(k) - 1.

Examples

			251 = 2^2 * 3^2 * 5^0 * 7^1 - 1 and 839 = 2^3 * 3^1 * 5^1 * 7^1 - 1 are terms.
		

Crossrefs

Programs

  • Mathematica
    With[{n = 2000}, Sort@ Select[Flatten@ Table[2^p * 3^q * 5^r * 7^s - 1, {p, 0, Log[2, n]}, {q, 0, Log[3, n/(2^p)]}, {r, 0, Log[5, n/(2^p * 3^q)]}, {s, 0, Log[7, n/(2^p * 3^q * 5^r)]}], PrimeQ]] (* Amiram Eldar, Sep 25 2021 after Michael De Vlieger at A293194 *)
  • PARI
    isok(p) = isprime(p) && (vecmax(factor(p+1)[,1]) < 11); \\ Michel Marcus, Nov 10 2021
    
  • PARI
    upto(limit)={my(P=[2,3,5,7]); local(L=List()); my(recurse(k,t) = if(t<=limit+1, if(k>#P, if(isprime(t-1), listput(L,t-1)), my(b=P[k]); for(e=0, logint(limit+1,b), self()(k+1, t*b^e))))); recurse(1, 1); vecsort(Vec(L))} \\ Andrew Howroyd, Nov 20 2021
    
  • Python
    from itertools import count, islice
    from sympy import integer_log, isprime
    def A347977_gen(): # generator of terms
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            kmin = kmax >> 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x):
            c = x
            for i in range(integer_log(x,7)[0]+1):
                for j in range(integer_log(m:=x//7**i,5)[0]+1):
                    for k in range(integer_log(r:=m//5**j,3)[0]+1):
                        c -= (r//3**k).bit_length()
            return c
        yield from filter(isprime,(bisection(lambda k:n+f(k),n,n)-1 for n in count(1)))
    A347977_list = list(islice(A347977_gen(),30)) # Chai Wah Wu, Mar 31 2025