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.

This page as a plain text file.
%I A347977 #38 Apr 22 2025 05:15:11
%S A347977 2,3,5,7,11,13,17,19,23,29,31,41,47,53,59,71,79,83,89,97,107,127,139,
%T A347977 149,167,179,191,199,223,239,251,269,293,349,359,383,419,431,449,479,
%U A347977 499,503,587,599,647,719,809,839,863,881,971,1049,1151,1249,1259,1279,1399,1439,1499,1511,1567,1619,1889
%N A347977 Primes of the form 2^p * 3^q * 5^r * 7^s - 1.
%C A347977 Restricting to r = s = 0 gives A005105; s = 0 gives A293194.
%C A347977 Primes of the form A002473(k) - 1.
%H A347977 Flávio V. Fernandes, <a href="/A347977/b347977.txt">Table of n, a(n) for n = 1..10000</a>
%e A347977 251 = 2^2 * 3^2 * 5^0 * 7^1 - 1 and 839 = 2^3 * 3^1 * 5^1 * 7^1 - 1 are terms.
%t A347977 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 *)
%o A347977 (PARI) isok(p) = isprime(p) && (vecmax(factor(p+1)[,1]) < 11); \\ _Michel Marcus_, Nov 10 2021
%o A347977 (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
%o A347977 (Python)
%o A347977 from itertools import count, islice
%o A347977 from sympy import integer_log, isprime
%o A347977 def A347977_gen(): # generator of terms
%o A347977     def bisection(f,kmin=0,kmax=1):
%o A347977         while f(kmax) > kmax: kmax <<= 1
%o A347977         kmin = kmax >> 1
%o A347977         while kmax-kmin > 1:
%o A347977             kmid = kmax+kmin>>1
%o A347977             if f(kmid) <= kmid:
%o A347977                 kmax = kmid
%o A347977             else:
%o A347977                 kmin = kmid
%o A347977         return kmax
%o A347977     def f(x):
%o A347977         c = x
%o A347977         for i in range(integer_log(x,7)[0]+1):
%o A347977             for j in range(integer_log(m:=x//7**i,5)[0]+1):
%o A347977                 for k in range(integer_log(r:=m//5**j,3)[0]+1):
%o A347977                     c -= (r//3**k).bit_length()
%o A347977         return c
%o A347977     yield from filter(isprime,(bisection(lambda k:n+f(k),n,n)-1 for n in count(1)))
%o A347977 A347977_list = list(islice(A347977_gen(),30)) # _Chai Wah Wu_, Mar 31 2025
%Y A347977 Cf. A002473, A005105, A293194.
%K A347977 nonn
%O A347977 1,1
%A A347977 _Flávio V. Fernandes_, Sep 21 2021