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 21-30 of 32 results. Next

A060360 a(n) = k - (largest prime < k), where k = lcm(1..n).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 17, 17, 19, 19, 23, 23, 23, 17, 43, 43, 1, 1, 1, 1, 1, 1, 29, 29, 41, 41, 1, 1, 43, 1, 1, 1, 1, 1, 43, 43, 43, 43, 47, 47, 83, 83, 83, 83, 1, 1, 83, 83, 83, 83, 61, 61, 61, 61, 61, 61, 149, 149, 1, 1, 1, 97, 97, 97, 89, 89, 89, 89, 109, 109
Offset: 3

Views

Author

N. J. A. Sloane, Apr 01 2001

Keywords

Crossrefs

Programs

  • Mathematica
    lcmp[n_]:=Module[{c=LCM@@Range[n]},c-NextPrime[c,-1]]; Array[lcmp,80,3] (* Harvey P. Dale, Dec 22 2012 *)
  • PARI
    a(n) = my(lc = lcm([1..n])); lc - precprime(lc-1); \\ Michel Marcus, Mar 20 2018

Formula

a(n) = A049711(A003418(n)). - Michel Marcus, Mar 20 2018

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)).

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]

A078772 a(n) = phi(n-p) where p is largest prime < n, a(1) = a(2) = 1 by convention.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 4, 2, 1, 1, 1, 1, 2, 2, 4, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 4, 2, 1, 1, 2, 2, 4, 2, 1, 1, 1, 1, 2, 2, 4, 2, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 4, 2, 1, 1, 2, 2, 1, 1, 2, 2, 4, 2, 1, 1, 2, 2, 4, 2, 6, 4, 1, 1, 2
Offset: 1

Views

Author

Jon Perry, Jan 09 2003

Keywords

Comments

This sequence is a block of concatenations of vectors of lengths of prime gaps with elements phi(i) for i = 1 to that prime gap. Those vectors are (1), (1, 1), (1, 1, 2, 2), (1, 1, 2, 2, 4, 2), ... - David A. Corneth, Oct 20 2017

Examples

			a(10) = phi(10-7) = phi(3) = 2.
		

Crossrefs

Programs

  • PARI
    for (n=1,100, print1(eulerphi(n-precprime(n-1))","))
    
  • PARI
    first(n) = {n = nextprime(n); my(res = vector(n), phimap = Map(), q = 2, v); res[1] = res[2] = 1; forprime(p=3, n, if(!mapisdefined(phimap, p - q), mapput(phimap, p - q, vector(p - q, i, eulerphi(i)))); v = mapget(phimap, p-q); for(i = q + 1, p, res[i] = v[i - q]); q = p); res} \\ David A. Corneth, Oct 20 2017

Formula

For n >= 3, a(n) = A000010(A049711(n)). - Antti Karttunen, Oct 20 2017

Extensions

Description clarified by Antti Karttunen, Oct 20 2017

A235431 The smallest positive number that must be added to or subtracted from the sum of the first n primes in order to get a prime.

Original entry on oeis.org

1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 3, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 4, 3, 4, 1, 2, 5, 2, 1, 4, 1, 4, 1, 2, 3, 4, 5, 2, 3, 2, 5, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 2, 3, 2, 1, 2, 1, 10, 1, 4, 11, 2, 1, 6
Offset: 1

Views

Author

R. J. Cano, Jan 17 2014

Keywords

Comments

The primes in A013918 would have associated a(n)=0 if not for the qualifier "positive" in the definition.
The sum of the first n primes appears to be close to a prime. For illustration, the maximum for a(n) among the first 5 million terms is a(808500) = 218.
See A013916 for the above mentioned indices, numbers n such that the sum of the first n primes is prime. - M. F. Hasler, Jan 20 2014

Examples

			The sum of the first 9 primes is 100, and by adding 1 we get 101. Since 101 is a prime, a(9) = 1.
The sum of the first 10 primes is 129, since 129 - 2 = prime(31) = 127 or 129 + 2 = prime(32) = 131, a(10) = 2.
The sum of the first 129 primes minus 1 is a prime, this is 42468 - 1 = prime(4443), so a(129) = 1.
		

Crossrefs

Programs

  • PARI
    a(n)=my(u=sum(j=1,n,prime(j)),k=1);while(!(isprime(u+k)||isprime(u-k)),k++);k

Formula

Algorithm:
Let S be the sum of the first n primes;
initially, let k=1;
increment k while neither S-k nor S+k is prime;
return a(n)=k.
a(n) = min(A013632(A007504(n)), A049711(A007504(n))). - M. F. Hasler, Jan 20 2014

A289357 Least number k such that n^2 + n - k is prime.

Original entry on oeis.org

0, 1, 1, 1, 1, 1, 3, 1, 1, 1, 1, 5, 1, 11, 1, 1, 13, 5, 1, 1, 1, 3, 5, 1, 3, 1, 5, 1, 7, 1, 1, 5, 5, 3, 1, 5, 7, 1, 1, 3, 1, 5, 3, 1, 1, 1, 5, 1, 3, 1, 5, 3, 1, 1, 1, 1, 5, 9, 1, 1, 3, 17, 5, 1, 1, 1, 7, 1, 13, 1, 5, 19, 3, 19, 7, 1, 19, 11, 3, 7, 5, 3, 1, 11, 1
Offset: 1

Views

Author

Gionata Neri, Jul 03 2017

Keywords

Comments

a(A045546(n)) = 1.

Crossrefs

Cf. A002378, A045546, A049711, A161550 (resulting primes).

Programs

  • Maple
    0, seq(n^2 + n - prevprime(n^2+n), n=2..100); # Robert Israel, Jul 03 2017
  • Mathematica
    Table[k = 0; While[! PrimeQ[n^2 + n - k], k++]; k, {n, 85}] (* Michael De Vlieger, Jul 04 2017 *)
  • PARI
    for(n=1,85,k={my(k=0);while(!isprime(n^2+n-k),k++);k;};print1(k", "))

Formula

a(n) = A049711(A002378(n)). - Robert Israel, Jul 03 2017

A323741 a(n) = m-p where m = (2n+1)^2 and p is the largest prime < m.

Original entry on oeis.org

2, 2, 2, 2, 8, 2, 2, 6, 2, 2, 6, 6, 2, 2, 8, 2, 2, 2, 10, 12, 2, 8, 2, 2, 8, 6, 2, 20, 12, 2, 2, 6, 6, 2, 2, 6, 2, 2, 12, 8, 6, 6, 8, 2, 8, 2, 12, 6, 10, 8, 2, 22, 2, 14, 20, 6, 6, 2, 2, 2, 8, 6, 2, 8, 2, 6, 2, 12, 2, 14, 6, 2, 8, 8, 14, 10, 2, 18, 20, 2, 8, 14, 6, 2, 10, 2, 32, 2, 12, 12, 2, 8, 6, 44, 2, 6, 14, 6, 20, 14
Offset: 1

Views

Author

Ali Sada, Sep 03 2019

Keywords

Comments

a(n) cannot be a square: suppose a(n) = k^2; then p=m-a(n) could be factored as (2n+k-1)*(2n-k-1); hence it would not be a prime.
Legendre's conjecture implies a(n) <= 4*n. Oppermann's conjecture implies a(n) <= 2*n. - Robert Israel, Sep 04 2019
All terms are even. - Alois P. Heinz, Sep 04 2019

Examples

			When n=4, m=81, p=79, so a(4) = 81-79 = 2.
		

Crossrefs

Programs

  • Maple
    seq((2*n+1)^2-prevprime((2*n+1)^2),n=1..100); # Robert Israel, Sep 04 2019
  • Mathematica
    mp[n_]:=Module[{m=(2n+1)^2},m-NextPrime[m,-1]]; Array[mp, 100] (* Harvey P. Dale, Feb 03 2022 *)
  • PARI
    a(n) = (2*n+1)^2 - precprime((2*n+1)^2 - 1); \\ Michel Marcus, Sep 05 2019

Formula

a(n) = A049711(A016754(n)).

A033557 2n - {largest prime < n}.

Original entry on oeis.org

4, 5, 7, 7, 9, 9, 11, 13, 15, 13, 15, 15, 17, 19, 21, 19, 21, 21, 23, 25, 27, 25, 27, 29, 31, 33, 35, 31, 33, 33, 35, 37, 39, 41, 43, 39, 41, 43, 45, 43, 45, 45, 47, 49, 51, 49, 51, 53, 55, 57, 59, 55, 57, 59, 61, 63
Offset: 3

Views

Author

Keywords

Crossrefs

A049711(n) + n.

Programs

  • Maple
    f := n->2*n-prevprime(n); [ seq(f(i),i=3..60) ];

A309760 Even numbers k such that k-p is composite where p is the largest prime <= k.

Original entry on oeis.org

122, 148, 190, 208, 220, 250, 292, 302, 326, 346, 418, 430, 476, 518, 532, 538, 556, 586, 628, 640, 670, 700, 718, 782, 796, 806, 820, 838, 848, 872, 896, 902, 928, 962, 1006, 1030, 1048, 1060, 1078, 1084, 1138, 1144, 1150, 1162, 1180, 1210, 1246, 1258, 1268, 1274
Offset: 1

Views

Author

Aaron Schäfers, Aug 15 2019

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Range[4, 1274, 2], CompositeQ[# - NextPrime[#, -1]] &] (* Amiram Eldar, Sep 17 2019 *)
  • PARI
    is(n) = if(n%2==1 ||n==2, return(0)); my(c = n - precprime(n)); !isprime(c) && c != 1 \\ David A. Corneth, Aug 21 2019

A333839 a(n) = Sum_{k = 4..n} ((prevprime(k) + nextprime(k))/2 - k).

Original entry on oeis.org

0, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 2, 4, 5, 5, 4, 2, 0, 0, 2, 4, 5, 5, 4, 2, 1, 2, 2, 1, 0, 0, 1, 2, 2, 1, 2, 4, 5, 5, 4, 2, 2, 4, 5, 5, 4, 2, 0, 0, 2, 4, 5, 5, 4, 2, 1, 2, 2, 1, 0, 0, 2, 4, 5, 5, 4, 2, 1, 2, 2, 1, 2, 4, 5, 5, 4, 2, 3, 6, 8, 9, 9, 8, 6
Offset: 4

Views

Author

Ctibor O. Zizka, Apr 07 2020

Keywords

Comments

It looks like a(n) >= 0 for all n >= 4.
If (n,n+2) are twin primes, then a(n) = 0 and a(n+1) = 0.
Partial sums of b(k) = prevprime(k) + nextprime(k) - 2*k; b(k) = 0 for A145025.

Examples

			a(4) = (3 + 5)/2 - 4 = 0;
a(5) = (3 + 5)/2 - 4 + (3 + 7)/2 - 5 = 0.
		

Crossrefs

Programs

  • Mathematica
    Array[Sum[Total[NextPrime[k, {-1, 1}]]/2 - k, {k, 4, #}] &, 92, 4] (* Michael De Vlieger, Apr 10 2020 *)

Formula

a(n) = Sum_{k = 4..n} (A013632(k) - A049711(k)) / 2.
Previous Showing 21-30 of 32 results. Next