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.

A293194 Primes of the form 2^q * 3^r * 5^s - 1.

This page as a plain text file.
%I A293194 #28 Apr 22 2025 04:33:03
%S A293194 2,3,5,7,11,17,19,23,29,31,47,53,59,71,79,89,107,127,149,179,191,199,
%T A293194 239,269,359,383,431,449,479,499,599,647,719,809,863,971,1151,1249,
%U A293194 1279,1439,1499,1619,1999,2399,2591,2699,2879,2999,4049,4373,4799,4999,5119,5399,6143,6911
%N A293194 Primes of the form 2^q * 3^r * 5^s - 1.
%C A293194 Mersenne primes A000668 occur when (q, r, s) = (q, 0, 0) with q > 0.
%C A293194 a(2) = 3 is a Mersenne prime but a(3) = 7 is not.
%C A293194 For n > 2, all terms = {1, 5} mod 6.
%H A293194 Robert Israel, <a href="/A293194/b293194.txt">Table of n, a(n) for n = 1..10000</a>
%e A293194 3 is a member because 3 is a prime number and 2^2 * 3^0 * 5^0 - 1 = 3.
%e A293194 89 is a member because 89 is a prime number and 2^1 * 3^2 * 5^1 - 1 = 89.
%e A293194 list of (q, r, s): (0, 1, 0), (2, 0, 0), (1, 1, 0), (3, 0, 0), (2, 1, 0), (1, 2, 0), (2, 0, 1), (3, 1, 0),(1, 1, 1), (5, 0, 0), (4, 1, 0), (1, 3, 0), (2, 1, 1), ...
%p A293194 N:= 10^6: # to get all terms <= N
%p A293194 R:= {}:
%p A293194 for c from 0 to floor(log[5]((N+1))) do
%p A293194   for b from 0 to floor(log[3]((N+1)/5^c)) do
%p A293194      R:= R union select(isprime, {seq(2^a*3^b*5^c-1,
%p A293194          a=0..ilog2((N+1)/(3^b*5^c)))})
%p A293194 od od:
%p A293194 sort(convert(R,list)); # _Robert Israel_, Oct 15 2017
%t A293194 With[{n = 7000}, Sort@ Select[Flatten@ Table[2^q * 3^r * 5^s - 1, {q, 0, Log[2, n/(1)]}, {r, 0, Log[3, n/(2^q)]}, {s, 0, Log[5, n/(2^q * 3^r)]}], PrimeQ]] (* _Michael De Vlieger_, Oct 02 2017 *)
%o A293194 (GAP) K := 10^5 + 1;; # to get all terms less than or equal to K
%o A293194 A := Filtered([1 .. K], IsPrime);; I := [3, 5];;
%o A293194 B := List(A, i -> Elements(Factors(i + 1)));;
%o A293194 C := List([0 .. Length(I)], j -> List(Combinations(I, j), i -> Concatenation([2], i)));
%o A293194 A293194 := Concatenation([2], List(Set(Flat(List([1 .. Length(C)], i -> List([1 .. Length(C[i])], j -> Positions(B, C[i][j]))))), i -> A[i]));
%o A293194 (PARI) lista(nn) = {forprime(p=2,nn, if (vecmax(factor(p+1)[,1]) <= 5, print1(p, ", ")););} \\ _Michel Marcus_, Oct 06 2017
%o A293194 (Python)
%o A293194 from itertools import count, islice
%o A293194 from sympy import integer_log, isprime
%o A293194 def A293194_gen(): # generator of terms
%o A293194     def bisection(f,kmin=0,kmax=1):
%o A293194         while f(kmax) > kmax: kmax <<= 1
%o A293194         kmin = kmax >> 1
%o A293194         while kmax-kmin > 1:
%o A293194             kmid = kmax+kmin>>1
%o A293194             if f(kmid) <= kmid:
%o A293194                 kmax = kmid
%o A293194             else:
%o A293194                 kmin = kmid
%o A293194         return kmax
%o A293194     def f(x):
%o A293194         c = x
%o A293194         for i in range(integer_log(x,5)[0]+1):
%o A293194             for j in range(integer_log(m:=x//5**i,3)[0]+1):
%o A293194                 c -= (m//3**j).bit_length()
%o A293194         return c
%o A293194     yield from filter(isprime,(bisection(lambda k:n+f(k),n,n)-1 for n in count(1)))
%o A293194 A293194_list = list(islice(A293194_gen(),30)) # _Chai Wah Wu_, Mar 31 2025
%Y A293194 Cf. A000668, A005105, A293425.
%K A293194 nonn
%O A293194 1,1
%A A293194 _Muniru A Asiru_, Oct 02 2017