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 101-110 of 130 results. Next

A359300 a(n) = (distance from n to nearest prime >= n) - (distance from n to nearest prime <= n).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 2, 0, -2, 0, 0, 0, 2, 0, -2, 0, 0, 0, 2, 0, -2, 0, 4, 2, 0, -2, -4, 0, 0, 0, 4, 2, 0, -2, -4, 0, 2, 0, -2, 0, 0, 0, 2, 0, -2, 0, 4, 2, 0, -2, -4, 0, 4, 2, 0, -2, -4, 0, 0, 0, 4, 2, 0, -2, -4, 0, 2, 0, -2, 0, 0, 0, 4, 2, 0, -2, -4, 0, 2, 0
Offset: 2

Views

Author

Clark Kimberling, Jan 01 2023

Keywords

Examples

			a(8) = 2 because (11-8) - (8-7) = 2.
		

Crossrefs

Programs

  • Maple
    f:= n -> nextprime(n-1) + prevprime(n+1) - 2*n:
    map(f, [$2..100]); # Robert Israel, Jan 03 2023
  • Mathematica
    u[n_] := If[PrimeQ[n], n, NextPrime[n]];
    v[n_] := If[PrimeQ[n], n, NextPrime[n, -1]];
    Table[u[n] - n - (n - v[n]), {n, 2, 350}]

Formula

a(n) = A007917(n) + A007918(n) - 2*n. - Bernard Schott, Jan 01 2023

A378252 Least prime power > 2^n.

Original entry on oeis.org

2, 3, 5, 9, 17, 37, 67, 131, 257, 521, 1031, 2053, 4099, 8209, 16411, 32771, 65537, 131101, 262147, 524309, 1048583, 2097169, 4194319, 8388617, 16777259, 33554467, 67108879, 134217757, 268435459, 536870923, 1073741827, 2147483659, 4294967311, 8589934609
Offset: 0

Views

Author

Gus Wiseman, Nov 30 2024

Keywords

Comments

Prime powers are listed by A246655.
Conjecture: All terms except 9 are prime. Hence this is the same as A014210 after 9. Confirmed up to n = 1000.

Crossrefs

Subtracting 2^n appears to give A013597 except at term 3.
For prime we have A014210.
For previous we have A014234.
For perfect power we have A357751.
For squarefree we have A372683.
A000015 gives the least prime power >= n.
A000040 lists the primes, differences A001223.
A000961 and A246655 list the prime powers, differences A057820.
A024619 and A361102 list the non prime powers, diffs A375708 and A375735.
A031218 gives the greatest prime power <= n.
A244508 counts prime powers between powers of 2.
Prime powers between primes are counted by A080101 and A366833.

Programs

  • Mathematica
    Table[NestWhile[#+1&,2^n+1,!PrimePowerQ[#]&],{n,0,20}]
  • PARI
    a(n) = my(x=2^n+1); while (!isprimepower(x), x++); x; \\ Michel Marcus, Dec 03 2024
  • Python
    from itertools import count
    from sympy import primefactors
    def A378252(n): return next(i for i in count(1+(1<Chai Wah Wu, Dec 02 2024
    

A049852 Concatenate "n" and "nextprime(n)".

Original entry on oeis.org

12, 23, 35, 45, 57, 67, 711, 811, 911, 1011, 1113, 1213, 1317, 1417, 1517, 1617, 1719, 1819, 1923, 2023, 2123, 2223, 2329, 2429, 2529, 2629, 2729, 2829, 2931, 3031, 3137, 3237, 3337, 3437, 3537, 3637, 3741, 3841, 3941, 4041, 4143, 4243
Offset: 1

Views

Author

Keywords

Comments

From Petros Hadjicostas, Nov 20 2019: (Start)
Version 1 of the "next prime" function is A007918: smallest prime >= n. PARI/GP's nextprime() is version 1.
Maple's nextprime() is the version 2 that appears in A151800: smallest prime > n. We use version 2 here. (End)

Examples

			From _Petros Hadjicostas_, Nov 20 2019: (Start)
a(1) = 12 because nextprime(1) = 2.
a(2) = 23 because nextprime(2) = 3.
a(3) = 35 because nextprime(3) = 5.
a(4) = 45 because nextprime(4) = 5.
...
a(10) = 1011 because nextprime(10) = 11.
a(11) = 1113 because nextprime(11) = 13.
... (End)
		

Crossrefs

Cf. A007918 (version 1 of nextprime), A151800 (version 2 of nextprime).

Programs

  • Maple
    a:= n-> parse(cat(n, nextprime(n))):
    seq(a(n), n=1..50);  # Alois P. Heinz, Nov 20 2019
  • PARI
    a(n) = eval(concat(Str(n), Str(nextprime(n+1)))); \\ Michel Marcus, Jan 01 2017

A060847 Difference between a nontrivial prime power (A246547) and the previous prime.

Original entry on oeis.org

1, 1, 2, 3, 2, 4, 1, 2, 3, 2, 8, 12, 1, 2, 2, 5, 6, 6, 2, 3, 6, 6, 2, 2, 8, 3, 4, 2, 12, 2, 9, 8, 18, 2, 2, 6, 4, 12, 2, 3, 6, 4, 2, 6, 12, 8, 2, 6, 2, 1, 6, 8, 2, 2, 14, 4, 6, 2, 6, 2, 3, 20, 2, 12, 2, 2, 8, 14, 10, 18, 8, 6, 2, 2, 2, 12, 12, 19, 2, 6, 6, 20, 2, 2, 2, 8, 8, 2, 2, 8, 20, 12, 15, 2, 4
Offset: 1

Views

Author

Labos Elemer, May 03 2001

Keywords

Comments

a(n)=1 only for some powers of 2.

Examples

			78125=5^7 follows 78121, the difference is 4.
		

Crossrefs

Programs

  • Maple
    N:= 10^5: # to consider prime powers <= N
    P:= select(isprime,[2,seq(i,i=3..floor(sqrt(N)),2)]):
    PP:= sort([seq(seq(p^k,k=2..ilog[p](N)),p=P)]):
    map(t -> t - prevprime(t), PP); # Robert Israel, Nov 13 2024
  • Python
    from sympy import primepi, integer_nthroot, prevprime
    def A060847(n):
        def f(x): return int(n+x-sum(primepi(integer_nthroot(x,k)[0]) for k in range(2,x.bit_length())))
        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
        return (a:=bisection(f,n,n))-prevprime(a) # Chai Wah Wu, Sep 13 2024

Formula

a(n) = A246547(n)-prevprime(A246547(n)) = A246547(n)-A049711(A246547(n)).

A060848 Difference between a nontrivial prime power (A025475) and the next prime.

Original entry on oeis.org

1, 3, 2, 1, 4, 2, 5, 4, 3, 2, 6, 2, 3, 4, 8, 1, 4, 4, 6, 9, 12, 6, 4, 12, 6, 7, 30, 4, 12, 12, 5, 16, 6, 4, 10, 10, 12, 10, 6, 3, 4, 6, 10, 4, 6, 2, 4, 10, 6, 17, 4, 10, 4, 18, 6, 30, 12, 12, 4, 10, 27, 4, 6, 4, 12, 4, 28, 6, 2, 10, 4, 4, 10, 12, 18, 10, 10, 3, 12, 4, 12, 6, 10, 10, 18, 10, 12
Offset: 1

Views

Author

Labos Elemer, May 03 2001

Keywords

Comments

a(n)=1 only for some powers of 2 corresponding to Fermat primes > 3. - Edited by Robert Israel, Jun 03 2021

Examples

			78125=5^7 is followed by 78137, the difference is 12.
		

Crossrefs

Programs

  • Maple
    N:= 10^5: # for prime powers <= N
    S:= {}:
    p:= 1:
    do
      p:= nextprime(p);
      if p^2 > N then break fi;
      S:= S union {seq(p^i,i=2..floor(log[p](N)))}
    od:
    map(t -> nextprime(t)-t, sort(convert(S,list))); # Robert Israel, Jun 03 2021
  • Mathematica
    NextPrime[#]-#&/@Select[Range[100000],PrimePowerQ[#]&&!PrimeQ[#]&] (* Harvey P. Dale, Oct 19 2022 *)

Formula

a(n) = nextprime(A025475(n)) - A025475(n) = A013632(A025475(n)).

A060849 Difference between 2 consecutive primes between which a nontrivial power of prime is found.

Original entry on oeis.org

2, 4, 4, 4, 6, 6, 6, 6, 6, 4, 14, 14, 4, 6, 10, 6, 10, 10, 8, 12, 18, 12, 6, 14, 14, 10, 34, 6, 24, 14, 14, 24, 24, 6, 12, 16, 16, 22, 8, 6, 10, 10, 12, 10, 18, 10, 6, 16, 8, 18, 10, 18, 6, 20, 20, 34, 18, 14, 10, 12, 30, 24, 8, 16, 14, 6, 36, 20, 12, 28, 12, 10, 12, 14, 20, 22, 22
Offset: 1

Views

Author

Labos Elemer, May 03 2001

Keywords

Examples

			59049=3^10 is between 59029 and 59051, so the corresponding term is 59051-59029=22.
		

Crossrefs

Programs

  • PARI
    ispp(n) = isprimepower(n) >= 2; \\ A246547
    lista(nn) = {for (n=1, nn, if (ispp(n), print1(nextprime(n) - precprime(n), ", ")););} \\ Michel Marcus, Mar 23 2020

Formula

a(n) = nextprime(A246547(n)) - prevprime(A246547(n)) = A013633(A246547(n)). [corrected by Michel Marcus, Mar 23 2020]

A079476 First prime greater than or equal to phi(n^2).

Original entry on oeis.org

2, 2, 7, 11, 23, 13, 43, 37, 59, 41, 113, 53, 157, 89, 127, 131, 277, 109, 347, 163, 257, 223, 509, 193, 503, 313, 487, 337, 821, 241, 937, 521, 661, 547, 853, 433, 1361, 691, 937, 641, 1657, 509, 1811, 881, 1087, 1013, 2179, 769, 2063, 1009, 1637, 1249, 2767
Offset: 1

Views

Author

Jon Perry, Jan 15 2003

Keywords

Comments

The sequence generally goes up,down,up,down...

Examples

			phi(3^2)=phi(9)=6, therefore a(3)=7.
		

Crossrefs

Programs

  • Maple
    map(t -> nextprime(numtheory:-phi(t^2)-1), [$1..100]); # Robert Israel, Oct 25 2017
  • Mathematica
    Array[If[PrimeQ@ #, #, NextPrime@ #] &@ EulerPhi[#^2] &, 53] (* Michael De Vlieger, Oct 25 2017 *)
  • PARI
    for (n=1,100, print1(nextprime(eulerphi(n^2))","))

Formula

a(n) = A007918(A002618(n)). - Robert Israel, Oct 25 2017

Extensions

Corrected by Robert Israel, Oct 25 2017

A084571 Let a(1)=1; for n>1, a(n)=nextprime((3/2)*a(n-1)).

Original entry on oeis.org

1, 2, 3, 5, 11, 17, 29, 47, 71, 107, 163, 251, 379, 569, 857, 1289, 1949, 2927, 4391, 6599, 9901, 14867, 22303, 33457, 50207, 75323, 112997, 169501, 254257, 381389, 572087, 858149, 1287233, 1930879, 2896319, 4344479, 6516739, 9775111, 14662727
Offset: 1

Views

Author

Paul D. Hanna, May 30 2003

Keywords

Comments

The definition refers to the nextprime() function in A007918.

Crossrefs

Cf. A084572.

Programs

  • Mathematica
    Join[{1,2},NestList[NextPrime[(3/2)*#]&,3,36]] (* Jayanta Basu, May 26 2013 *)
  • PARI
    a(n)=if(n<2,1,nextprime((3/2)*a(n-1))); for(n=1,50,print1(a(n),","))

A084748 Primes of the form n! + p where p is the smallest prime > n.

Original entry on oeis.org

3, 5, 11, 29, 127, 727, 5051, 3628811, 8683317618811886495518194401280000037, 2658271574788448768043625811014615890319638528000000047, 12413915592536072670862289047373375038521486354677760000000053
Offset: 1

Views

Author

Amarnath Murthy and Meenakshi Srikanth (menakan_s(AT)yahoo.com), Jun 16 2003

Keywords

Comments

Let a term k! + p = prime(r) then prime(r) -prime(r-1) >=p-1.

Examples

			727 = 6! + 7 belongs to this sequence but 8! +11 is composite and is not a member.
		

Crossrefs

Cf. A084749.

Formula

a(n) = A084749(n)!+A007918(A084749(n)+1). - David Wasserman, Jan 04 2005

Extensions

More terms from David Wasserman, Jan 04 2005

A097521 Difference between F(n) = 2^(2^n)+1 and nextprime(F(n)) where F(n) is the n-th Fermat Number.

Original entry on oeis.org

2, 2, 2, 6, 2, 14, 12, 50, 296, 74, 642, 980, 1760, 896, 2774, 118112, 44060, 5850
Offset: 0

Views

Author

Cino Hilliard, Aug 27 2004

Keywords

Comments

In the Name, nextprime means A151800, not A007918. - Jeppe Stig Nielsen, Nov 18 2019
a(n) = A129786(n)-1 except in the rare case that F(n) is a prime. - Jeppe Stig Nielsen, Nov 18 2019

Examples

			F(5) = 4294967297. Nextprime(F(5)) = 4294967311.
4294967311 - 4294967297 = 14 the 6th entry in the table.
		

Crossrefs

Programs

  • PARI
    for(n=0,+oo,print1(nextprime(2^(2^n)+2)-(2^(2^n)+1),", ")) \\ Jeppe Stig Nielsen, Nov 18 2019

Formula

a(n) = A013632(A000215(n)). - Michel Marcus, Nov 18 2019

Extensions

More terms with the help of A129786 from Jeppe Stig Nielsen, Nov 18 2019
Previous Showing 101-110 of 130 results. Next