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.

Previous Showing 31-40 of 51 results. Next

A060845 Largest prime < a nontrivial power of a prime.

Original entry on oeis.org

3, 7, 7, 13, 23, 23, 31, 47, 61, 79, 113, 113, 127, 167, 241, 251, 283, 337, 359, 509, 523, 619, 727, 839, 953, 1021, 1327, 1367, 1669, 1847, 2039, 2179, 2179, 2207, 2399, 2803, 3121, 3469, 3719, 4093, 4483, 4909, 5039, 5323, 6229, 6553, 6857, 6883, 7919
Offset: 1

Views

Author

Labos Elemer, May 03 2001

Keywords

Examples

			78125=5^7 follows 78121
		

Crossrefs

Programs

  • Mathematica
    Take[NextPrime[#,-1]&/@Union[Flatten[Table[Prime[p]^n,{n,2,20},{p,25}]]], 50] (* Harvey P. Dale, Mar 26 2012 *)
  • PARI
    { m=1; for (n=1, 1000, m++; while(sigma(m)*eulerphi(m)*(1 - isprime(m)) <= (m - 1)^2, m++); write("b060845.txt", n, " ", precprime(m - 1)); ) } \\ Harry J. Smith, Jul 19 2009
    
  • Python
    from sympy import primepi, integer_nthroot, prevprime
    def A060845(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: 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 int(n+x-sum(primepi(integer_nthroot(x,k)[0]) for k in range(2,x.bit_length())))
        return prevprime(bisection(f,n,n)) # Chai Wah Wu, Sep 15 2024

Formula

a(n) = prevprime[A025475(n)] = A007917[A025475(n)] = Max{p| p < A025475(n)}

A072917 a(n) = p(n) - phi(n), where p(n) is the least prime greater than phi(n).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 3, 1, 1, 1, 3, 1, 1, 1, 3, 3, 1, 1, 1, 1, 3, 1, 1, 3, 1, 5, 1, 1, 1, 5, 1, 1, 1, 1, 3, 5, 1, 1, 1, 1, 3, 5, 5, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 5, 5, 3, 1, 5, 3, 5, 1, 5, 1, 1, 1, 1, 1, 5, 1, 5, 5, 1, 1, 5, 3, 1, 3, 1, 1, 5, 1, 3, 1, 1, 1, 5, 1, 1, 1, 1
Offset: 1

Views

Author

Joseph L. Pe, Aug 11 2002

Keywords

Examples

			phi(15) = 8 and the least prime > 8 is 11; hence a(15) = 11 - 8 = 3.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := Module[{r, p}, p = EulerPhi[n]; r = p + 1; While[ ! PrimeQ[r], r = r + 1]; r - p]; Table[a[i], {i, 1, 100}]
    lpg[n_]:=Module[{ep=EulerPhi[n]},NextPrime[ep]-ep]; Array[lpg,200] (* Harvey P. Dale, May 29 2017 *)
  • PARI
    A072917(n) = (nextprime(1+eulerphi(n)) - eulerphi(n)); \\ Antti Karttunen, Aug 22 2017

Formula

a(n) = A013632(A000010(n)). - Antti Karttunen, Aug 22 2017

A093701 a(n) = smallest m>a(n-1) such that 1+m*n is prime, a(1) = 1.

Original entry on oeis.org

1, 2, 4, 7, 8, 10, 16, 17, 18, 19, 30, 31, 34, 35, 36, 37, 38, 41, 58, 59, 62, 64, 72, 73, 76, 77, 80, 81, 84, 85, 88, 95, 96, 97, 102, 103, 106, 111, 114, 118, 122, 123, 124, 125, 130, 132, 134, 135, 138, 140, 142, 144, 150, 152, 156, 158, 164, 166, 174, 175
Offset: 1

Views

Author

Reinhard Zumkeller, Apr 10 2004

Keywords

Comments

A093702(n) = 1+a(n)*n.

Examples

			For n=3: we have a(2)=2, so we want the smallest number m > 2 such that n*m+1 = 3*m+1 is prime. m=3 fails but m=4 works, so a(3) = m = 4. - _N. J. A. Sloane_, Dec 13 2018
		

Crossrefs

Note that A081942 is a related but distinct sequence.

Programs

  • Mathematica
    nxt[{n_,a_}]:=Module[{m=a+1},While[!PrimeQ[m(n+1)+1],m++];{n+1,m}]; NestList[ nxt,{1,1},60][[All,2]] (* Harvey P. Dale, Dec 13 2018 *)

A101597 Number of consecutive composite numbers between balanced primes and their lower or upper prime neighbor.

Original entry on oeis.org

1, 5, 5, 5, 11, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 11, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 11, 5, 5, 5, 11, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 11, 5, 5, 5, 5, 5, 11, 5, 5, 5, 5, 11, 11, 5, 11, 5, 5, 5, 5, 5, 5, 5, 5, 11, 5, 5, 5, 5, 5, 5, 5, 5, 11, 5, 5, 5, 5, 5, 5, 5, 5, 5
Offset: 1

Views

Author

Cino Hilliard, Jan 26 2005

Keywords

Comments

These numbers are not always prime with 35 occurring for prime(n) n<1000000.
The first 35 occurs at a(947). - Antti Karttunen, Dec 16 2017

Examples

			53 has the 5 consecutive composites 48,49,50,51,52 below it and the 5 consecutive composites 54,55,56,57,58 above it so 5 is in the second position in the table.
		

Crossrefs

Programs

  • Mathematica
    Flatten[Differences /@ Select[Partition[Prime@ Range[1900], 3, 1], #2 == Mean@ {#1, #3} & @@ # &][[All, 1 ;; 2]] - 1] (* Michael De Vlieger, Dec 16 2017 *)
  • PARI
    betwixtpr(n) = { local(c1,c2,x,y); for(x=2,n, c1=c2=0; for(y=prime(x-1)+1,prime(x)-1, if(!isprime(y),c1++); ); for(y=prime(x)+1,prime(x+1)-1, if(!isprime(y),c2++); ); if(c1==c2,print1(c1",")) ) }
    
  • PARI
    up_to = 10000; n = 0; forprime(p=1, oo, if((d=(p-precprime(p-1)))==(nextprime(p+1)-p), n++; write("b101597.txt", n, " ", d-1); if(n>=up_to,break))); \\ Antti Karttunen, Dec 16 2017

Formula

a(n) = A013632(A006562(n))-1. - Antti Karttunen, Dec 16 2017

Extensions

Offset changed from 2 to 1 by Antti Karttunen, Dec 16 2017

A123317 Smallest prime power m such that n+m is a prime number.

Original entry on oeis.org

1, 1, 2, 1, 2, 1, 4, 3, 2, 1, 2, 1, 4, 3, 2, 1, 2, 1, 4, 3, 2, 1, 8, 5, 4, 3, 2, 1, 2, 1, 16, 5, 4, 3, 2, 1, 4, 3, 2, 1, 2, 1, 4, 3, 2, 1, 32, 5, 4, 3, 2, 1, 8, 5, 4, 3, 2, 1, 2, 1, 256, 5, 4, 3, 2, 1, 4, 3, 2, 1, 2, 1, 16, 5, 4, 3, 2, 1, 4, 3, 2, 1, 128, 5, 4, 3, 2, 1, 8, 7, 16, 5, 4, 3, 2, 1, 4, 3, 2, 1, 2, 1
Offset: 1

Views

Author

Reinhard Zumkeller, Sep 27 2006

Keywords

Examples

			n=23: 23+1=3*2^3, 23+2=5^2, 23+3=13*2, 23+2^2=3^3, 23+5=7*2^2, 23+7=5*3*2, but 23+8=31=A000040(11), therefore a(23)=8;
n=24: 24+1=5^2, 24+2=13*2, 24+3=3^3, 24+2^2=7*2^2, but 24+5=29=A000040(10), therefore a(24)=5;
the smallest occurring proper odd prime power is 9=3^2:
n=118: 118+1=17*7, 118+2=5*3*2^3, 118+3=11^2, 118+2^2=61*2, 118+5=41*3, 118+7=5^3, 118+2^3=7*2*3^2, but 118+3^2=127=A000040(31), therefore a(118)=9.
		

Crossrefs

Programs

  • Maple
    A123317 := proc(n)
        local m ;
        m :=1 ;
        if isprime(n+m) then
            return m ;
        end if;
        for m from 2 do
            if nops(numtheory[factorset](m)) = 1 then
                if isprime(n+m) then
                    return m;
                end if;
            end if;
        end do:
    end proc:
    seq(A123317(n),n=1..102) ; # R. J. Mathar, Aug 09 2019

Formula

A123318(n) = n + a(n);
a(A006093(n)) = 1; a(A040976(n)) = 2 for n>2.

A204669 Primes p such that q-p = 62, where q is the next prime after p.

Original entry on oeis.org

34061, 190409, 248909, 295601, 305147, 313409, 473027, 479639, 531731, 633497, 682079, 693881, 724331, 777479, 877469, 896201, 1011827, 1088309, 1137341, 1152527, 1179047, 1181777, 1190081, 1210289, 1216619, 1226117, 1272749, 1281587, 1286711, 1305449, 1343801, 1345361, 1357361, 1464179
Offset: 1

Views

Author

N. J. A. Sloane, Jan 17 2012

Keywords

Comments

All terms == 5 mod 6. - Zak Seidov, Jan 01 2013
There are no two consecutive primes in the sequence, while there are such primes p=prime(m) that q=prime(m+2) is also a term.
First such p's are at indices 554, 908, 1902, 2588, 3035, 5320, 6213, 6881, 7853, 8262, which correspond to 10237391, 15442121, 27374771, 36040469, 41216027, 66544301, 76313597, 83565611, 93112589, 97515359 (respectively). Note that a(554) = 10237391 = A226657(31). - Zak Seidov, Jul 01 2015
Primes p such that A013632(p) = 62. - Robert Israel, Jul 02 2015

Crossrefs

Programs

  • Magma
    [n: n in [2..2*10^6 ] | (NextPrime(n)-NextPrime(n-1)) eq 62]; // Vincenzo Librandi, Jul 02 2015
  • Maple
    p:= 2:
    count:= 0:
    while count < 40 do
      q:= nextprime(p);
      if q - p = 62 then
        count:= count+1;
        A[count]:= p;
      fi;
      p:= q;
    od:
    seq(A[i],i=1..count); # Robert Israel, Jul 02 2015
  • Mathematica
    Select[Prime@ Range@ 120000, NextPrime@ # - # == 62 &] (* Michael De Vlieger, Jul 01 2015 *)
    Select[Partition[Prime[Range[120000]],2,1],#[[2]]-#[[1]]==62&][[All,1]] (* Harvey P. Dale, Apr 01 2017 *)
  • PARI
    g=62;c=o=0;forprime(p=1,default(primelimit),(-o+o=p)==g&write("c:/temp/b204669.txt",c++" "p-g))  \\ M. F. Hasler, Jan 18 2012
    

A226381 Numbers n such that the distance from n to the next prime is the same as the distance from n^2 to the next prime.

Original entry on oeis.org

1, 2, 3, 4, 6, 7, 8, 9, 10, 13, 15, 16, 21, 31, 36, 37, 38, 39, 40, 45, 48, 50, 57, 61, 64, 66, 67, 76, 81, 85, 91, 97, 99, 103, 105, 111, 126, 130, 131, 141, 147, 150, 151, 154, 156, 163, 168, 171, 180, 181, 185, 193, 202, 207, 210, 216, 225, 235, 237, 240, 246, 248, 249, 250, 253
Offset: 1

Views

Author

Gerasimov Sergey, Jun 05 2013

Keywords

Comments

Numbers n such that (smallest prime > n)- n = (smallest prime > n^2)- n^2.
Primes in the sequence are: 2, 3, 7, 13, 31, 37, 61, 67, 97, 103, 131, 151, 163, 181, 193,...

Examples

			1 is in the sequence because the distance from 1 to 2 is the same as the distance from 1^2 to 2.
2 is in the sequence because the distance from 2 to 3 is the same as the distance from 2^2 to 5.
3 is in the sequence because the distance from 3 to 5 is the same as the distance from 3^2 to 11.
		

Programs

  • Mathematica
    Select[Range[235], NextPrime[#] - # == NextPrime[#^2] - #^2 &] (* Giovanni Resta, Jun 09 2013 *)
  • PARI
    is(n)=nextprime(n+1)-n==nextprime(n^2)-n^2 \\ Charles R Greathouse IV, Jun 14 2013

Formula

{n: A013632(n) = A013632(n^2)}. - R. J. Mathar, Jun 09 2013

Extensions

Corrected by Giovanni Resta, Jun 09 2013

A338570 Primes p such that q*r mod p is prime, where q is the prime preceding p and r is the prime following p.

Original entry on oeis.org

11, 13, 19, 29, 31, 37, 47, 53, 59, 67, 73, 83, 89, 109, 127, 131, 151, 163, 173, 179, 211, 239, 251, 263, 269, 283, 307, 337, 359, 373, 383, 421, 433, 443, 449, 467, 479, 499, 503, 523, 541, 547, 569, 593, 599, 607, 653, 659, 677, 757, 787, 797, 829, 853, 877, 907, 919, 947, 967, 971, 977, 1033
Offset: 1

Views

Author

J. M. Bergot and Robert Israel, Nov 02 2020

Keywords

Comments

Primes p such that -A049711(p)*A013632(p) mod p is prime.
Includes primes p such that p-8, p-2 and p+4 are also prime. Dickson's conjecture implies that there are infinitely many of these.

Examples

			a(3) = 19 is a member because 19 is prime, the previous and following primes are 17 and 23, and (17*23) mod 19 = 11 is prime.
		

Crossrefs

Programs

  • Maple
    R:= NULL: p:= 0: q:= 2: r:= 3:
    count:= 0:
    while count < 100 do
      p:= q; q:= r; r:= nextprime(r);
      if isprime(p*r mod q) then count:= count+1; R:= R, q;  fi;
    od:
    R;

A338578 Primes p such that (r-p)*(r-q) > r, where q and r are the next two primes.

Original entry on oeis.org

2, 3, 5, 11, 17, 19, 29, 43, 47, 83, 109, 199, 283
Offset: 1

Views

Author

Robert Israel, Nov 03 2020

Keywords

Comments

a(14) > 10^8 if it exists.
As soon as the prime gap grows slow enough, for all large enough p we have (r-p)*(r-q) <= r, implying finiteness of this sequence. In particular, finiteness would follow from Cramer's conjecture. - Max Alekseyev, Nov 09 2024

Examples

			a(5)=17 is a member because it is prime, the next two primes are 19 and 23, and (23-17)*(23-19)=24 > 23.
		

Crossrefs

Contains A338566.

Programs

  • Maple
    p:= 0: q:=2:r:= 3:  R:= NULL:
    while p < 10^4 do
      p:= q: q:= r: r:= nextprime(r);
      if (r-q)*(r-p) > r then R:= R, p; fi
    od:
    R;

A058018 Difference between LCM(1,...,x) and the smallest prime > LCM(1,...,x), where x is the n-th prime power (A000961).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 13, 1, 13, 31, 23, 19, 1, 41, 1, 31, 43, 1, 41, 53, 79, 59, 1, 59, 61, 113, 97, 179, 73, 73, 97, 103, 101, 109, 1, 229, 109, 139, 113, 227, 131, 191, 163, 1, 199, 151, 139, 1, 223, 229, 367, 239, 499, 251, 509, 251, 227, 373, 281, 233, 283, 229, 277, 263
Offset: 1

Views

Author

Labos Elemer, Nov 14 2000

Keywords

Comments

The first value corresponds to x = 1, LCM(1) = 1.
For the first 100 prime powers, the value is either prime or 1.
The values of x are taken to be prime powers so that each distinct LCM occurs exactly once.

Examples

			The 6th distinct prime power is A000961(7) = 8, LCM(1,...,8) = 840 and 853 is the first prime that follows, thus a(7) = 853-840 = 13.
		

Crossrefs

Programs

  • Mathematica
    With[{max = 250}, (NextPrime[#] - #)& /@ Exp[Accumulate[Join[{0}, Select[Array[MangoldtLambda, max], # > 0 &]]]]] (* Amiram Eldar, Aug 13 2024 *)
  • PARI
    lista(nn) = {for (n=1, nn, if ((n==1) || isprimepower(n), v = lcm(vector(n, x, x)); print1(nextprime(v+1) - v, ", ")););} \\ Michel Marcus, Apr 09 2015

Formula

a(n) = A013632(A051451(n)) = A058017(n) - A051451(n). - Amiram Eldar, Aug 13 2024

Extensions

Edited by Franklin T. Adams-Watters, Aug 15 2006
Offset set to 1 by Michel Marcus, Apr 09 2015
Name corrected by Amiram Eldar, Aug 13 2024
Previous Showing 31-40 of 51 results. Next