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-10 of 15 results. Next

A151799 Version 2 of the "previous prime" function: largest prime < n.

Original entry on oeis.org

2, 3, 3, 5, 5, 7, 7, 7, 7, 11, 11, 13, 13, 13, 13, 17, 17, 19, 19, 19, 19, 23, 23, 23, 23, 23, 23, 29, 29, 31, 31, 31, 31, 31, 31, 37, 37, 37, 37, 41, 41, 43, 43, 43, 43, 47, 47, 47, 47, 47, 47, 53, 53, 53, 53, 53, 53, 59, 59, 61, 61, 61, 61, 61, 61, 67, 67, 67, 67, 71, 71, 73, 73, 73, 73
Offset: 3

Views

Author

N. J. A. Sloane, Jun 29 2009

Keywords

Comments

Version 1 of the "previous prime" function is "largest prime <= n". This produces A007917, the same sequence of numerical values, except the offset (or indexing) starts at 2 instead of 3.
Maple's "prevprime" function uses version 2.
See A007917 for references and further information.

Crossrefs

Programs

Formula

a(n) = A000040(A000720(n-1)). - Enrique Pérez Herrero, Jul 23 2011
a(n) = n + 1 - Sum_{k=1..n}( floor(k!^(n-1)/(n-1)!)-floor((k!^(n-1)-1)/(n-1)!) ). - Anthony Browne, May 17 2016
a(n) = A060265(floor(n/2)) for n >= 4. - Georg Fischer, Nov 29 2022

A060308 Largest prime <= 2n.

Original entry on oeis.org

2, 3, 5, 7, 7, 11, 13, 13, 17, 19, 19, 23, 23, 23, 29, 31, 31, 31, 37, 37, 41, 43, 43, 47, 47, 47, 53, 53, 53, 59, 61, 61, 61, 67, 67, 71, 73, 73, 73, 79, 79, 83, 83, 83, 89, 89, 89, 89, 97, 97, 101, 103, 103, 107, 109, 109, 113, 113, 113, 113, 113, 113, 113, 127, 127, 131
Offset: 1

Views

Author

Labos Elemer, Mar 27 2001

Keywords

Comments

a(n) is the smallest k such that C(2n,n) divides k!. - Benoit Cloitre, May 30 2002
a(n) is largest prime factor of C(2n,n) = (2n)!/(n!)^2. - Alexander Adamchuk, Jul 11 2006
a(n) is also the largest prime in the interval [n,2n]. - Peter Luschny, Mar 04 2011
Odd prime p repeats (q-p)/2 times, where q > p is the next prime. In particular, every lesser of twin primes (A001359) occurs 1 time, every lesser more than 3 of cousin primes (A023200) occurs 2 times, etc. - Vladimir Shevelev, Mar 12 2012

Examples

			n=1, 2n=2, p(1) = 2 = a(1) is the largest prime not exceeding 2.
		

Crossrefs

Apart from initial term, same as A060265.
Cf. A007917 (largest prime <= n), A005843 (2n).

Programs

Formula

a(n) = Max[FactorInteger[(2n)!/(n!)^2]]. - Alexander Adamchuk, Jul 11 2006
a(n) = A006530(A000142(2*n)) and a(n) = A006530(A056040(2*n)). - Peter Luschny, Mar 04 2011
a(n) ~ 2*n as n tends to infinity. - Vladimir Shevelev, Mar 12 2012
a(n) = A007917(A005843(n)) = A226078(n, A067434(n)). - Reinhard Zumkeller, May 25 2013

Extensions

More terms from Alexander Adamchuk, Jul 11 2006

A020900 Greatest k such that k-th prime < twice n-th prime.

Original entry on oeis.org

2, 3, 4, 6, 8, 9, 11, 12, 14, 16, 18, 21, 22, 23, 24, 27, 30, 30, 32, 34, 34, 37, 38, 40, 44, 46, 46, 47, 47, 48, 54, 55, 58, 59, 62, 62, 65, 66, 67, 68, 71, 72, 75, 76, 77, 78, 82, 86, 87, 88, 90, 91, 92, 95, 97, 99, 99, 100, 101, 102, 103, 106, 112
Offset: 1

Views

Author

Keywords

Examples

			4th prime is 7, twice the 4th prime is 14, the greatest prime < 14 is 13 that is the 6th prime, hence, a(4) = 6. - _Bernard Schott_, Feb 02 2020
		

Crossrefs

Cf. A000720 (pi(n)), A100484 (2*prime(n)).
Cf. A102820 (first differences).

Programs

  • Mathematica
    PrimePi[NextPrime[#,-1]]&/@(2Prime[Range[70]]) (* Harvey P. Dale, Jul 05 2012 *)
  • PARI
    a(n) = primepi(2*prime(n)); \\ Michel Marcus, Oct 25 2017; Feb 02 2020

Formula

a(n) = A000720(A100484(n)). - Michel Marcus, Feb 02 2020

A118750 a(n) = product[k=1..n] P(k), where P(k) is the largest prime <= 3*k. a(n) = product[k=1..n] A118749(k).

Original entry on oeis.org

3, 15, 105, 1155, 15015, 255255, 4849845, 111546435, 2565568005, 74401472145, 2306445636495, 71499814731345, 2645493145059765, 108465218947450365, 4664004414740365695, 219208207492797187665, 10302785752161467820255
Offset: 1

Views

Author

Jonathan Vos Post, Apr 29 2006

Keywords

Comments

Differs from (after first term) A048599 "Partial products of the sequence (A001097) of twin primes" after 8th term. Differs from (after first term) A070826 "One half of product of first n primes A000040" after 9th term. Analogous to A118455 a(1)=1. a(n) = product{k=1..n} P(k), where P(k) is the largest prime <= k.

Crossrefs

A255313 Triangle read by rows: row n contains the sums of adjacent pairs of terms in row n of A088643.

Original entry on oeis.org

3, 5, 3, 7, 5, 3, 7, 5, 7, 5, 11, 7, 5, 7, 5, 13, 11, 7, 5, 7, 5, 13, 11, 13, 11, 7, 5, 3, 17, 13, 11, 13, 11, 7, 5, 3, 19, 17, 13, 11, 13, 11, 7, 5, 3, 19, 17, 19, 17, 13, 11, 7, 5, 7, 5, 23, 19, 17, 19, 17, 13, 11, 7, 5, 7, 5, 23, 19, 17, 19, 23, 19, 13
Offset: 1

Views

Author

Reinhard Zumkeller, Feb 22 2015

Keywords

Comments

All terms are prime by definition of A088643.
See A255313 for sorted distinct terms and A255395 for number of distinct terms.

Examples

			.  n |                  T(n,k)                    |       A255316
. ---+--------------------------------------------+----------------------
.  1 |  3                                         | 3
.  2 |  5  3                                      | 3 5
.  3 |  7  5  3                                   | 3 5  7
.  4 |  7  5  7  5                                | 5 7
.  5 | 11  7  5  7  5                             | 5 7 11
.  6 | 13 11  7  5  7  5                          | 5 7 11 13
.  7 | 13 11 13 11  7  5  3                       | 3 5  7 11 13
.  8 | 17 13 11 13 11  7  5  3                    | 3 5  7 11 13 17
.  9 | 19 17 13 11 13 11  7  5  3                 | 3 5  7 11 13 17 19
. 10 | 19 17 19 17 13 11  7  5  7  5              | 5 7 11 13 17 19
. 11 | 23 19 17 19 17 13 11  7  5  7  5           | 5 7 11 13 17 19 23
. 12 | 23 19 17 19 23 19 13 11  7  5  7  5        | 5 7 11 13 17 19 23
. 13 | 23 19 23 19 17 23 19 11  7 11 13  7  3     | 3 7 11 13 17 19 23
. 14 | 29 23 19 23 19 17 23 19 11  7 11 13  7  3  | 3 7 11 13 17 19 23 29
		

Crossrefs

Programs

  • Haskell
    a255313 n k = a255313_tabl !! (n-1) !! (k-1)
    a255313_row n = a255313_tabl !! (n-1)
    a255313_tabl = zipWith (zipWith (+)) tss $ map tail tss
                   where tss = tail a088643_tabl
  • Mathematica
    (* A is A088643 *)
    A[n_, 1] := n;
    A[n_, k_] := A[n, k] = For[m = n-1, m >= 1, m--, If[PrimeQ[m + A[n, k-1]] && FreeQ[Table[A[n, j], {j, 1, k-1}], m], Return[m]]];
    T[n_] := T[n] = 2 MovingAverage[Table[A[n+1, k], {k, 1, n+1}], {1, 1}];
    Array[T, 14] // Flatten (* Jean-François Alcover, Aug 02 2021 *)

Formula

T(n,k) = A088643(n,k-1) + A088643(n,k), 1 <= k <= n;
T(n,1) = A060265(n+1);

A060267 Difference between 2 closest primes surrounding 2n.

Original entry on oeis.org

2, 2, 4, 4, 2, 4, 4, 2, 4, 4, 6, 6, 6, 2, 6, 6, 6, 4, 4, 2, 4, 4, 6, 6, 6, 6, 6, 6, 2, 6, 6, 6, 4, 4, 2, 6, 6, 6, 4, 4, 6, 6, 6, 8, 8, 8, 8, 4, 4, 2, 4, 4, 2, 4, 4, 14, 14, 14, 14, 14, 14, 14, 4, 4, 6, 6, 6, 2, 10, 10, 10, 10, 10, 2, 6, 6, 6, 6, 6, 6, 4, 4, 6, 6, 6, 6, 6, 6, 2, 10, 10, 10, 10, 10, 2, 4
Offset: 2

Views

Author

Labos Elemer, Mar 23 2001

Keywords

Examples

			a(3) = 2 because the closest primes to 2*3 = 6 are (5,7) and the difference between these is 2. - _Michael De Vlieger_, Nov 02 2017
		

Crossrefs

Programs

  • Maple
    with(numtheory): [seq(nextprime(2*i)-prevprime(2*i),i=2..256)];
  • Mathematica
    Array[Subtract @@ NextPrime[#, {1, -1}] &[2 #] &, 96, 2] (* Michael De Vlieger, Nov 02 2017 *)
    NextPrime[#]-NextPrime[#,-1]&/@(2*Range[2,100]) (* Harvey P. Dale, Nov 07 2017 *)
  • PARI
    a(n) = nextprime(2*n+1) - precprime(2*n-1); \\ Michel Marcus, Sep 16 2020

A088631 Largest number m < n such that m+n is a prime.

Original entry on oeis.org

1, 2, 3, 2, 5, 6, 5, 8, 9, 8, 11, 10, 9, 14, 15, 14, 13, 18, 17, 20, 21, 20, 23, 22, 21, 26, 25, 24, 29, 30, 29, 28, 33, 32, 35, 36, 35, 34, 39, 38, 41, 40, 39, 44, 43, 42, 41, 48, 47, 50, 51, 50, 53, 54, 53, 56, 55, 54, 53, 52, 51, 50, 63, 62, 65, 64, 63, 68, 69, 68, 67, 66, 65, 74, 75
Offset: 2

Views

Author

N. J. A. Sloane, Nov 24 2003

Keywords

Examples

			Adding 1,2,3,2,5 to 2,3,4,5,6 we get the primes 3,5,7,7,11.
		

Crossrefs

Cf. A088633. Second column of A088643.

Programs

  • Haskell
    a088631 n = a060265 n - n  -- Reinhard Zumkeller, Feb 22 2015
  • Maple
    with(numtheory); A088631 := n->prevprime(2*n)-n;

Formula

a(n) = p-n where p = largest prime <= 2n-1.
a(n) = A060265(n) - n. - Reinhard Zumkeller, Feb 22 2015

A118747 a(n) = product[k=1..n] P(k), where P(k) is the largest prime <= 2*k. a(n) = product[k=1..n] A060308(k).

Original entry on oeis.org

2, 6, 30, 210, 1470, 16170, 210210, 2732730, 46456410, 882671790, 16770764010, 385727572230, 8871734161290, 204049885709670, 5917446685580430, 183440847252993330, 5686666264842793230, 176286654210126590130
Offset: 1

Views

Author

Jonathan Vos Post, Apr 29 2006

Keywords

Crossrefs

A118752 a(n) = product[k=0..n] P(k), where P(k) is the smallest prime > 3*n. a(n) = product[k=0..n] A118751(k).

Original entry on oeis.org

2, 10, 70, 770, 10010, 170170, 3233230, 74364290, 2156564410, 62540367890, 1938751404590, 71733801969830, 2654150672883710, 108820177588232110, 4679267636293980730, 219925578905817094310, 11656055682008305998430
Offset: 0

Views

Author

Jonathan Vos Post, Apr 29 2006

Keywords

Comments

Analogous to A118456 a(n) = product{k=1..n} P(k), where P(k) is the smallest prime >= k.

Crossrefs

Programs

  • Mathematica
    Rest[FoldList[Times,1,Table[NextPrime[3n],{n,0,20}]]] (* Harvey P. Dale, Mar 09 2014 *)

Extensions

Definition corrected by Harvey P. Dale, Mar 09 2014

A120303 Largest prime factor of Catalan number A000108(n).

Original entry on oeis.org

2, 5, 7, 7, 11, 13, 13, 17, 19, 19, 23, 23, 23, 29, 31, 31, 31, 37, 37, 41, 43, 43, 47, 47, 47, 53, 53, 53, 59, 61, 61, 61, 67, 67, 71, 73, 73, 73, 79, 79, 83, 83, 83, 89, 89, 89, 89, 97, 97, 101, 103, 103, 107, 109, 109, 113, 113, 113, 113, 113, 113, 113, 127, 127, 131, 131
Offset: 2

Views

Author

Alexander Adamchuk, Jul 13 2006

Keywords

Comments

All prime numbers (except 3) are present in this sequence in their natural order with repetition. The number of repetitions is equal to A028334(n): differences between consecutive primes, divided by 2. - Alexander Adamchuk, Jul 30 2006
For p>3 a((p+1)/2) = p and all a(n) = p for n >= (p+1)/2 until the first occurrence of the next prime q = NextPrime(p) at a((q+1)/2) = q. - Alexander Adamchuk, Dec 27 2013
For n>2, a(n) is the largest prime less than 2*n. - Gennady Eremin, Mar 02 2021

Examples

			G.f. = 2*x^2 + 5*x^3 + 7*x^4 + 7*x^5 + 11*x^6 + 13*x^7 + 13*x^8 + 17*x^9 + ...
		

Crossrefs

Programs

  • Mathematica
    Table[Max[FactorInteger[(2n)!/n!/(n+1)! ]],{n,2,100}]
    FactorInteger[CatalanNumber[#]][[-1,1]]&/@Range[2,70] (* Harvey P. Dale, May 02 2017 *)
  • PARI
    a(n) = vecmax(factor(binomial(2*n, n)/(n+1))[,1]); \\ Michel Marcus, Nov 14 2015
    
  • PARI
    a(n)=if(n>2,precprime(2*n),2) \\ Charles R Greathouse IV, Nov 17 2015
    
  • Python
    from gmpy2 import is_prime
    A120303 = [2]
    for n in range(3, 801):
        for k in range(2*n-1, n, -2):
            if is_prime(k, n):
                A120303.append(k)
                break
    for n in range(len(A120303)):
        print(n+2, A120303[n])  # Gennady Eremin, Mar 17 2021

Formula

a(n) = A060308(n) = A060265(n) for n>2.
a(n) = A006530(A000108(n)). - Michel Marcus, Nov 14 2015
G.f.: A(x) - x^2, where A(x) is the g.f. of A060265. - Gennady Eremin, Mar 02 2021
Showing 1-10 of 15 results. Next