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-8 of 8 results.

A005105 Class 1+ primes: primes of the form 2^i*3^j - 1 with i, j >= 0.

Original entry on oeis.org

2, 3, 5, 7, 11, 17, 23, 31, 47, 53, 71, 107, 127, 191, 383, 431, 647, 863, 971, 1151, 2591, 4373, 6143, 6911, 8191, 8747, 13121, 15551, 23327, 27647, 62207, 73727, 131071, 139967, 165887, 294911, 314927, 442367, 472391, 497663, 524287, 786431, 995327
Offset: 1

Views

Author

Keywords

Comments

The definition is given by Guy: a prime p is in class 1+ if the only prime divisors of p + 1 are 2 or 3; and p is in class r+ if every prime factor of p + 1 is in some class <= r+ - 1, with equality for at least one prime factor. - N. J. A. Sloane, Sep 22 2012
See A005109 for the definition of class r- primes.
Odd terms are primes satisfying p==-1 (mod phi(p+1)). - Benoit Cloitre, Feb 22 2002
These are the primes p for which p+1 is 3-smooth. Primes for which either p+1 or p-1 have many small factors are more easily proved prime, so most of the largest primes found have this property. - Michael B. Porter, Feb 19 2013
For n>1, x=2*a(n) is a solution to the equation phi(sigma(x)) = x-phi(x). Also all Mersenne primes are in the sequence. - Jahangeer Kholdi, Sep 28 2014

Examples

			23 is in the sequence since 23 is prime and 23 + 1 = 24 = 2^3 * 3 has all prime factors less than or equal to 3.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, A18.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • GAP
    A:=Filtered([1..10^7],IsPrime);;     I:=[3];;
    B:=List(A,i->Elements(Factors(i+1)));;
    C:=List([0..Length(I)],j->List(Combinations(I,j),i->Concatenation([2],i)));;
    A005105:=Concatenation([2],List(Set(Flat(List([1..Length(C)],i->List([1..Length(C[i])],j->Positions(B,C[i][j]))))),i->A[i])); # Muniru A Asiru, Sep 28 2017
    
  • Magma
    [p: p in PrimesUpTo(6*10^6) | forall{d: d in PrimeDivisors(p+1) | d le 3}]; // Bruno Berselli, Sep 24 2012
    
  • Maple
    For Maple program see Mathar link.
    # Alternative:
    N:= 10^6: # to get all terms <= N
    select(isprime,{seq(seq(2^i*3^j-1, i=0..ilog2(N/3^j)), j=0..floor(log[3](N)))});
    # if using Maple 11 or earlier, uncomment the following line
    # sort(convert(%,list));  # Robert Israel, Sep 28 2014
  • Mathematica
    mx = 10^6; Select[ Sort@ Flatten@ Table[2^i*3^j - 1, {i, 0, Log[2, mx]}, {j, 0, Log[3, mx/2^i]}], PrimeQ] (* or *)
    Prime[ Select[ Range[78200], Mod[ Prime[ # ] + 1, EulerPhi[ Prime[ # ] + 1]] == 0 &]] (* or *)
    PrimeFactors[n_Integer] := Flatten[ Table[ #[[1]], {1}] & /@ FactorInteger[n]]; f[n_Integer] := Block[{m = n}, If[m == 0, m = 1, While[ IntegerQ[m/2], m /= 2]; While[ IntegerQ[m/3], m /= 3]]; Apply[Times, PrimeFactors[m] + 1]]; ClassPlusNbr[n_] := Length[ NestWhileList[f, n, UnsameQ, All]] - 3; Prime[ Select[ Range[3, 78200], ClassPlusNbr[ Prime[ # ]] == 1 &]]
  • PARI
    list(lim)=my(v=List(), N); lim=1+lim\1; for(n=0, logint(lim,3), N=3^n; while(N<=lim, if(ispseudoprime(N-1),listput(v, N-1)); N<<=1)); Set(v) \\ Charles R Greathouse IV, Jul 15 2011; corrected Sep 22 2015
    
  • Python
    from itertools import count, islice
    from sympy import integer_log, isprime
    def A069353(n):
        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): return n+x-sum(((x+1)//3**i).bit_length() for i in range(integer_log(x+1,3)[0]+1))
        return bisection(f,n-1,n-1)
    def A005105_gen(): # generator of terms
        return filter(lambda n:isprime(n), map(A069353,count(1)))
    A005105_list = list(islice(A005105_gen(),30)) # Chai Wah Wu, Mar 31 2025

Formula

{primes p : A126433(PrimePi(p)) = 1 }. - R. J. Mathar, Sep 24 2012

Extensions

More terms from Benoit Cloitre, Feb 22 2002
Edited and extended by Robert G. Wilson v, Mar 20 2003

A005113 Smallest prime in class n (sometimes written n+) according to the Erdős-Selfridge classification of primes.

Original entry on oeis.org

2, 13, 37, 73, 1021, 2917, 15013, 49681, 532801, 1065601, 8524807, 68198461, 545587687, 1704961513, 23869461181, 288310406533
Offset: 1

Views

Author

Keywords

Comments

A prime p is in class 1 if (p+1)'s largest prime factor is 2 or 3. If (p+1) has other prime factors, p's class is one more than the largest class of its prime factors. See also A005105.
John W. Layman observes that for n=10..13, the ratios r(n)= a(n)/a(n-1) are increasingly close to an integer, being 1.9999981, 7.99999906, 8.00000059 and 7.999999985.
Layman's observation is a consequence of a(n+1) = m*a(n)-1 for (n,m)=(1,7),(3,2),(4,14),(9,2),(10,8),(12,8),(14,14), while a(12) = 8 a(11)+5 is a coincidence which does not fit into that scheme. This relationship is not unusual since any N+ prime p is by definition such that p+1 = m*q where q is a (N-1)+ prime and m = (p+1)/q must be even since p,q are odd (except for q=2, allowing the odd m=7 for n=1 above) and the least N+ prime has good chances of having q equal to the least (N-1)+ prime. - M. F. Hasler, Apr 09 2007
a(n+1) >= 2*a(n)-1 since a(n+1)+1 = p*q with p of class n+ (thus >= a(n) and odd) and thus q >= 2 (even and positive). a(n+1) <= min { p = 2*k*a(n)-1 | k=1,2,3,... such that p is prime }. - M. F. Hasler, Apr 02 2007
a(17) <= 1833174628057, with equality if 916587314029 is the 10th 16+ prime; a(18) <= 3666349256113, with equality if a(17) = 1833174628057; a(19) <= 65994286610033, with equality if 41431295033731 is the third 18+ prime; a(20) <= 764276710625653, with equality if 382138355312827 is the third 19+ prime. - M. F. Hasler, Apr 09 2007

Examples

			1553 is in class 4 because 1553+1 = 2*3*7*37; 7 is in class 1 and 37 is in class 3. 37 is in class 3 because 37+1 = 2*19 and 19 is in class 2. 19 is in class 2 because 19+1 = 2*2*5 and 5 is in class 1. 5 is in class 1 because 5+1=2*3.
		

References

  • R. K. Guy, Unsolved Problems in Number Theory, A18.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Mathematica
    PrimeFactors[n_Integer] := Flatten[ Table[ #[[1]], {1}] & /@ FactorInteger[n]]; NextPrime[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; f[n_Integer] := Block[{m = n}, If[m == 0, m = 1, While[ IntegerQ[m/2], m /= 2]; While[ IntegerQ[m/3], m /= 3]]; Apply[Times, PrimeFactors[m] + 1]]; ClassPlusNbr[n_] := Length[ NestWhileList[f, n, UnsameQ, All]] - 3; a = Table[0, {15}]; a[[1]] = 2; k = 5; Do[c = ClassPlusNbr[ k]; If[ a[[c]] == 0, a[[c]] = k]; k = NextPrime[k], {n, 1, 28700000}]; a
  • PARI
    checkclass(n,p)={ n=factor(n+1)[,1]; n[#n] <= 3 && return(1); (#p <= 1 || n[#n] < p[#p]) && return(2); n[1]=p[#p]; p=vecextract(p,"^-1"); forstep( i=#n,2,-1, n[i] < n[1] && break; checkclass(n[i],p) > #p && return(2+#p)) }
    A005113(n,p,a=[])={ while( #a #a, p=nextprime(p+1)); a=concat(a,p); p=a[#a]*2-2); a } \\ A005113(11) takes < 10 sec @ 2 GHz in 2007; less than 2.5 sec @ 2 GHz in 2013. \\ M. F. Hasler, Apr 02 2007
    
  • PARI
    class(n, s=+1 /* for n+ class; -1 for n- class */)={ isprime(n) || return; (( n=factor(n+s)[,1] ) && n[ #n]>3 ) || return(1); vecsort( vector( #n,i,class( n[i],s )))[#n]+1 }
    someofnextclass( a, limit=0, s=0, b=[], p)={ if(!s,/* guess + or - */ s=( class(a[1]) && class(a[1])==class(a[2]) )*2-1 ); print("looking for primes of class ", 1+class( a[1], s), ["+","-"][1+(s<0)] ); for( i=1,#a, p=-s; until( p>=limit, until( isprime(p), p+=a[i]<<1 ); b=concat(b,p); if( !limit, limit=p)) ); vecsort(b) };
    c=A090468; for(i=15,20,c=someofnextclass(c,9e12);print("least prime of class ",i,"+ is <= ",c[1])) \\  M. F. Hasler, Apr 09 2007

Extensions

Extended through a(12) by Robert G. Wilson v
a(13) from John W. Layman
a(14) from Don Reble, Apr 11 2003
a(15) from Sam Handler (sam_5_5_5_0(AT)yahoo.com), Aug 17 2006
a(7) corrected by Tomás Oliveira e Silva, Oct 27 2006
a(16) calculated using A129475(n) up to n=19 by M. F. Hasler, Apr 16 2007
Edited by Max Alekseyev, Aug 17 2013

A129470 Primes p such that the largest prime factor of p+1 has Erdős-Selfridge class+ < N-1 if p is of class N+.

Original entry on oeis.org

883, 1747, 2417, 2621, 3181, 3301, 3533, 3571, 3691, 3853, 4027, 4133, 4513, 4783, 4861, 4957, 5303, 5381, 5393, 5563, 5641, 5821, 6067, 6577, 6991, 7177, 7253, 7331, 8059, 8093, 8377, 8731, 8839, 8929, 8969, 9221, 9281, 9397, 9613, 9931
Offset: 1

Views

Author

M. F. Hasler, Apr 16 2007

Keywords

Comments

In practice the class+ of a prime p is most often given by 1 + the class of the largest prime factor of p+1; terms of this sequence are counterexamples to this "rule". Terms of this sequence are at least of class 3+, since primes of class 1+ and 2+ have all prime factors of p+1 of class 1+. Terms a(k) of this sequence are >= -1 + 2*A005113(N-1) * nextprime(A005113(N-1)), where N is the class of a(k).

Examples

			a(3) = 883 = -1 + 2*13*17 is a prime of class 3+ since 13 is of class 2+, but the largest divisor of 883+1 is 17 which is only of class 1+.
		

Crossrefs

Programs

  • PARI
    class(n,s=1)={n=factor(n+s)[,1];if(n[ #n]<=3,1,for(i=2,#n,n[1]=max(class(n[i],s)+1,n[1]));n[1])}; A129470(n=100,p=1,a=[])={ local(f); while( #a 3, f=factor(1+p=nextprime(p+1))[,1]); forstep( i=#f,2,-1, f[i]=class( f[i] ); if( f[i] > f[ #f], a=concat(a,p); /*print(#a," ",p);*/ break))); a}

A129471 Primes p of Erdos-Selfridge class 3+ with largest prime factor of p+1 not of class 2+.

Original entry on oeis.org

883, 1747, 2417, 2621, 3301, 3533, 3571, 3691, 3853, 4027, 4133, 4783, 4861, 5303, 5381, 5393, 5563, 5641, 5821, 6577, 6991, 7253, 7331, 8059, 8093, 8377, 8839, 8929, 8969, 9221, 9281, 9613, 9931, 10069, 10477, 10487, 10601, 10607, 10903, 11491
Offset: 1

Views

Author

M. F. Hasler, Apr 17 2007

Keywords

Comments

Examples

			a(1) = 883 = -1+2*13*17 is a prime of class 3+ since 13 is of class 2+, but the largest divisor of 883+1 is 17 which is only of class 1+.
		

Crossrefs

Programs

  • PARI
    class(n,s=1)={n=factor(n+s)[,1];if(n[ #n]<=3,1,for(i=2,#n,n[1]=max(class(n[i],s)+1,n[1]));n[1])}; A129471(n=100,p=1,a=[])={ local(f); while( #a 3 & 2 > class(f[ #f]), f=factor(1+p=nextprime(p+1))[,1]); forstep( i=#f-1,2,-1, if( 3 < f[1] = max( f[1],1+class( f[i] )), next(2))); if( f[1] == 3, a=concat(a,p); /*print(#a," ",p)*/)); a}

A129473 Primes p of Erdos-Selfridge class 5+ with largest prime factor of p+1 not of class 4+.

Original entry on oeis.org

15913, 18541, 22921, 36353, 47741, 49201, 52267, 55333, 60589, 64969, 66137, 66721, 69203, 72707, 73291, 74167, 75773, 78401, 79861, 80737, 82051, 84533, 90227, 90373, 95191, 95483, 95629, 97673, 99133, 101323, 103951, 104681, 104827
Offset: 1

Views

Author

M. F. Hasler, Apr 17 2007

Keywords

Comments

Examples

			a(1) = 15913 = -1+2*73*109 is a prime of class 5+ since 73 is of class 4+, but the largest divisor of 15913+1 is 109 which is only of class 2+.
		

Crossrefs

Programs

  • PARI
    class(n,s=1)={n=factor(n+s)[,1];if(n[ #n]<=3,1,for(i=2,#n,n[1]=max(class(n[i],s)+1,n[1]));n[1])}; A129473(n=100,p=1,a=[])={ local(f); while( #a 3 & 4 > class(f[ #f]), f=factor(1+p=nextprime(p+1))[,1]); forstep( i=#f-1,2,-1, if( 5 < f[1] = max( f[1],1+class( f[i] )), next(2))); if( f[1] == 5, a=concat(a,p); /*print(#a," ",p)*/)); a}

A129477 Primes p of Erdos-Selfridge class 6+ with largest prime factor of p+1 not of class 5+.

Original entry on oeis.org

2146141, 2182897, 2954773, 3199813, 3224317, 3285577, 3383593, 3505933, 3555121, 3567373, 3653137, 3775417, 3864037, 4250977, 4298533, 4328053, 4493773, 4504651, 4519981, 4572037, 4647277, 4692637, 4719061, 4726537
Offset: 1

Views

Author

M. F. Hasler, Apr 17 2007

Keywords

Comments

Examples

			a(1) = 2146141 = -1+2*1021*1051 = A129469[6] is a prime of class 6+ since 2146141+1 has prime factor 1021=A081633[1]=A005113[5] of class 5+, but the largest prime factor of 2146141+1 is 1051=A005107[65] of class 3+.
		

Crossrefs

Programs

  • PARI
    class(n,s=1)={n=factor(n+s)[,1];if(n[ #n]<=3,1,for(i=2,#n,n[1]=max(class(n[i],s)+1,n[1]));n[1])}; a129477(n=100,p=1,a=[])={local(f,a5=A005113[5]);p=max(p,a5*nextprime(a5+1)*2-1); while( #a2 & f[ #f-1] >= a5 & 5 > class(f[ #f]), f=factor(1+p=nextprime(p+1))[,1]); forstep( i=#f-1,2,-1, if( 6 < f[1] = max( f[1],1+class( f[i] )), next(2))); if( f[1] == 6, a=concat(a,p); print(#a," ",p))); a}

A129478 Primes p of Erdos-Selfridge class 7+ with largest prime factor of p+1 not of class 6+.

Original entry on oeis.org

17227801, 18207913, 18592957, 19433053, 19608073, 19678081, 20028121, 20518177, 20658193, 20833213, 21043237, 21218257, 21533293, 21743317, 22128361, 22303381, 23668537, 25068697, 25418737, 25453741
Offset: 1

Views

Author

M. F. Hasler, Apr 17 2007

Keywords

Comments

Examples

			a(1) = 17227801 = -1+2*2917*2953 = A129469[7] is a prime of class 7+ since 17227801+1 has prime factor 2917 = A081634[1] = A005113[6] of class 6+, but the largest prime factor of 17227801+1 is 2953 = A005107[175] of class 3+.
		

Crossrefs

Programs

  • PARI
    class(n,s=1)={n=factor(n+s)[,1];if(n[ #n]<=3,1,for(i=2,#n,n[1]=max(class(n[i],s)+1,n[1]));n[1])}; a129478(n=100,p=1,a=[])={local(f,a6=A005113[6]);p=max(p,a6*nextprime(a6+1)*2-2); while( #a2 & f[ #f-1] >= a6 & 6 > class(f[ #f]), f=factor(1+p=nextprime(p+1))[,1]); forstep( i=#f-1,2,-1, if( 7 < f[1] = max( f[1],1+class( f[i] )), next(2))); if( f[1] == 7, a=concat(a,p); print(#a," ",p))); a}

A129472 Primes p of Erdos-Selfridge class 4+ with largest prime factor of p+1 not of class 3+.

Original entry on oeis.org

3181, 4513, 4957, 6067, 7177, 8731, 9397, 10433, 13171, 14947, 15761, 17389, 19387, 19609, 22051, 22273, 22453, 22717, 23531, 23753, 24197, 26161, 27823, 28711, 37369, 37591, 38183, 38923, 39293, 40993, 41143, 42697, 43067, 44621, 44843
Offset: 1

Views

Author

M. F. Hasler, Apr 17 2007

Keywords

Comments

Examples

			a(1) = 3181 = -1+2*37*43 is a prime of class 4+ since 37 is of class 3+, but the largest divisor of 3181+1 is 43 which is only of class 2+.
		

Crossrefs

Programs

  • PARI
    class(n,s=1)={n=factor(n+s)[,1];if(n[ #n]<=3,1,for(i=2,#n,n[1]=max(class(n[i],s)+1,n[1]));n[1])}; A129472(n=100,p=1,a=[])={ local(f); while( #a 3 & 3 > class(f[ #f]), f=factor(1+p=nextprime(p+1))[,1]); forstep( i=#f-1,2,-1, if( 4 < f[1] = max( f[1],1+class( f[i] )), next(2))); if( f[1] == 4, a=concat(a,p); /*print(#a," ",p)*/)); a}
Showing 1-8 of 8 results.