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 11-20 of 133 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

A007918 Least prime >= n (version 1 of the "next prime" function).

Original entry on oeis.org

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

Views

Author

R. Muller and Charles T. Le (charlestle(AT)yahoo.com)

Keywords

Comments

Version 2 of the "next prime" function is "smallest prime > n". This produces A151800.
Maple uses version 2.
According to the "k-tuple" conjecture, a(n) is the initial term of the lexicographically earliest increasing arithmetic progression of n primes; the corresponding common differences are given by A061558. - David W. Wilson, Sep 22 2007
It is easy to show that the initial term of an increasing arithmetic progression of n primes cannot be smaller than a(n). - N. J. A. Sloane, Oct 18 2007
Also, smallest prime bounded by n and 2n inclusively (in accordance with Bertrand's theorem). Smallest prime >n is a(n+1) and is equivalent to smallest prime between n and 2n exclusively. - Lekraj Beedassy, Jan 01 2007
Run lengths of successive equal terms are given by A125266. - Felix Fröhlich, May 29 2022
Conjecture: if n > 1, then a(n) < n^(n^(1/n)). - Thomas Ordowski, Feb 23 2023

Crossrefs

Programs

  • Haskell
    a007918 n = a007918_list !! n
    a007918_list = 2 : 2 : 2 : concat (zipWith
                  (\p q -> (replicate (fromInteger(q - p)) q))
                                       a000040_list $ tail a000040_list)
    -- Reinhard Zumkeller, Jul 26 2012
    
  • Magma
    [2] cat [NextPrime(n-1): n in [1..80]]; // Vincenzo Librandi, Jan 14 2016
    
  • Maple
    A007918 := n-> nextprime(n-1); # M. F. Hasler, Apr 09 2008
  • Mathematica
    NextPrime[Range[-1, 72]] (* Jean-François Alcover, Apr 18 2011 *)
  • PARI
    A007918(n)=nextprime(n)  \\ M. F. Hasler, Jun 24 2011
    
  • PARI
    for(x=0,100,print1(nextprime(x)",")) \\ Cino Hilliard, Jan 15 2007
    
  • Python
    from sympy import nextprime
    def A007918(n): return nextprime(n-1) # Chai Wah Wu, Apr 22 2022

Formula

For n > 1: a(n) = A000040(A049084(A007917(n)) + 1 - A010051(n)). - Reinhard Zumkeller, Jul 26 2012
a(n) = A151800(n-1). - Seiichi Manyama, Apr 02 2018

A064216 Replace each p^e with prevprime(p)^e in the prime factorization of odd numbers; inverse of sequence A048673 considered as a permutation of the natural numbers.

Original entry on oeis.org

1, 2, 3, 5, 4, 7, 11, 6, 13, 17, 10, 19, 9, 8, 23, 29, 14, 15, 31, 22, 37, 41, 12, 43, 25, 26, 47, 21, 34, 53, 59, 20, 33, 61, 38, 67, 71, 18, 35, 73, 16, 79, 39, 46, 83, 55, 58, 51, 89, 28, 97, 101, 30, 103, 107, 62, 109, 57, 44, 65, 49, 74, 27, 113, 82, 127, 85, 24, 131
Offset: 1

Views

Author

Howard A. Landman, Sep 21 2001

Keywords

Comments

a((A003961(n) + 1) / 2) = n and A003961(a(n)) = 2*n - 1 for all n. If the sequence is indexed by odd numbers only, it becomes multiplicative. In this variant sequence, denoted b, even indices don't exist, and we get b(1) = a(1) = 1, b(3) = a(2) = 2, b(5) = 3, b(7) = 5, b(9) = 4 = b(3) * b(3), ... , b(15) = 6 = b(3) * b(5), and so on. This property can also be stated as: a(x) * a(y) = a(((2x - 1) * (2y - 1) + 1) / 2) for x, y > 0. - Reinhard Zumkeller [re-expressed by Peter Munn, May 23 2020]
Not multiplicative in usual sense - but letting m=2n-1=product_j (p_j)^(e_j) then a(n)=a((m+1)/2)=product_j (p_(j-1))^(e_j). - Henry Bottomley, Apr 15 2005
From Antti Karttunen, Jul 25 2016: (Start)
Several permutations that use prime shift operation A064989 in their definition yield a permutation obtained from their odd bisection when composed with this permutation from the right. For example, we have:
A243505(n) = A122111(a(n)).
A243065(n) = A241909(a(n)).
A244153(n) = A156552(a(n)).
A245611(n) = A243071(a(n)).
(End)

Examples

			For n=11, the 11th odd number is 2*11 - 1 = 21 = 3^1 * 7^1. Replacing the primes 3 and 7 with the previous primes 2 and 5 gives 2^1 * 5^1 = 10, so a(11) = 10. - _Michael B. Porter_, Jul 25 2016
		

Crossrefs

Odd bisection of A064989 and A252463.
Row 1 of A251721, Row 2 of A249821.
Cf. A048673 (inverse permutation), A048674 (fixed points).
Cf. A246361 (numbers n such that a(n) <= n.)
Cf. A246362 (numbers n such that a(n) > n.)
Cf. A246371 (numbers n such that a(n) < n.)
Cf. A246372 (numbers n such that a(n) >= n.)
Cf. A246373 (primes p such that a(p) >= p.)
Cf. A246374 (primes p such that a(p) < p.)
Cf. A246343 (iterates starting from n=12.)
Cf. A246345 (iterates starting from n=16.)
Cf. A245448 (this permutation "squared", a(a(n)).)
Cf. A253894, A254044, A254045 (binary width, weight and the number of nonleading zeros in base-2 representation of a(n), respectively).
Cf. A285702, A285703 (phi and sigma applied to a(n).)
Here obviously the variant 2, A151799(n) = A007917(n-1), of the prevprime function is used.
Cf. also A003961, A270430, A270431.

Programs

  • Mathematica
    Table[Times @@ Power[If[# == 1, 1, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger[2 n - 1], {n, 69}] (* Michael De Vlieger, Dec 18 2014, revised Mar 17 2016 *)
  • PARI
    a(n) = {my(f = factor(2*n-1)); for (k=1, #f~, f[k,1] = precprime(f[k,1]-1)); factorback(f);} \\ Michel Marcus, Mar 17 2016
    
  • Python
    from sympy import factorint, prevprime
    from operator import mul
    def a(n):
        f=factorint(2*n - 1)
        return 1 if n==1 else reduce(mul, [prevprime(i)**f[i] for i in f]) # Indranil Ghosh, May 13 2017
  • Scheme
    (define (A064216 n) (A064989 (- (+ n n) 1))) ;; Antti Karttunen, May 12 2014
    

Formula

a(n) = A064989(2n - 1). - Antti Karttunen, May 12 2014
Sum_{k=1..n} a(k) ~ c * n^2, where c = Product_{p prime > 2} ((p^2-p)/(p^2-q(p))) = 0.6621117868..., where q(p) = prevprime(p) (A151799). - Amiram Eldar, Jan 21 2023

Extensions

More terms from Reinhard Zumkeller, Sep 26 2001
Additional description added by Antti Karttunen, May 12 2014

A191898 Symmetric square array read by antidiagonals: T(n,1)=1, T(1,k)=1, T(n,k) = -Sum_{i=1..k-1} T(n-i,k) for n >= k, -Sum_{i=1..n-1} T(k-i,n) for n < k.

Original entry on oeis.org

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

Views

Author

Mats Granvik, Jun 19 2011

Keywords

Comments

Rows equal columns and are periodic. No zero elements are found (conjecture). The recurrence is related to the recurrence for the Mahonian numbers. The main diagonal is the Dirichlet inverse of the Euler totient function A023900 (conjecture). [The 2nd and 3rd formulas state that the conjecture is correct. R. J. Mathar, Sep 16 2017]
The sums from n=1 to infinity of T(n,k)/n converge to the Mangoldt function for column k (conjecture).
If gcd(n,k)=1 then T(n,k)=1 and if T(n,k)=1 then gcd(n,k)=1 (conjecture).
The Dirichlet generating functions for s > 1 for the columns appear to be (see A054535):
Zeta(s)*(1 + (Sum over all possible combinations of products of negative distinct prime factors of k, up to rearrangement, 1/((-1* first distinct prime factor)*(-1*second distinct prime factor)*(-1*third distinct prime factor * ...))^(s-1))).
Examples:
k=1: Zeta(s)
k=2: Zeta(s)*(1 - 1/2^(s-1))
k=3: Zeta(s)*(1 - 1/3^(s-1))
k=4: Zeta(s)*(1 - 1/2^(s-1))
k=5: Zeta(s)*(1 - 1/5^(s-1))
k=6: Zeta(s)*(1 - 1/2^(s-1) - 1/3^(s-1) + 1/6^(s-1))
k=7: Zeta(s)*(1 - 1/7^(s-1))
...
k=30: Zeta(s)*(1 - 1/2^(s-1) - 1/3^(s-1) - 1/5^(s-1) + 1/6^(s-1) + 1/10^(s-1) + 1/15^(s-1) - 1/30^(s-1))
...
(conjecture)
See triangle A142971 for negative distinct prime factors.
This could probably be checked by matrix multiplication.
The signs of the eigenvalues of this matrix are a rearrangement of the Mobius function A008683 (conjecture). The first few eigenvalues are:
{1.0000}
{-1.4142, 1.4142}
{-2.6554, 1.8662, -1.2108}
{-3.4393, 2.1004, -1.6611, 0}
{-4.7711, -3.3867, 2.5910, -1.4332, 0}
{-5.2439, -3.4641, 3.4641, 2.5169, -2.2730, 0}
The relation to Dirichlet characters for the entries in this matrix appears appears to be formulated in terms of the sequence A089026 which is equal to n if n is a prime, otherwise equal to 1. See Mathematica program below. [Mats Granvik, Nov 23 2013]
From Mats Granvik, Jun 19 2016: (Start)
Remark about the Dirichlet generating function for the whole matrix: Subtracting the first column (in the form of zeta(c)) of the matrix gives us the limit: lim_{c->1} zeta(s)*zeta(c)/zeta(c+s-1)-zeta(c) = -zeta'(s)/zeta(s) which is the classical Dirichlet generating function for the von Mangoldt function.
For n >= k, see A231425, this matrix has row sums equal to zero except for the first row:
1=1
1-1=0
1+1-2=0
1-1+1-1=0
1+1+1+1-4=0
...
log(A014963(n)) = Sum_{k>=1} A191898(n,k)/k, for n>1.
log(A014963(k)) = Sum_{n>=1} A191898(n,k)/n, for k>1.
log(A014963(n)) = limit of zeta(s)*(Sum_{d divides n} A008683(d)/d^(s-1)) as s->1, for n>1.
A008683(n) = Sum_{k=1..n} A191898(n,k)*exp(-i*2*Pi*k/n)/n.
A008683(n) = Sum_{n=1..k} A191898(n,k)*exp(-i*2*Pi*n/k)/k.
(End)
From Mats Granvik, Aug 09 2016: (Start)
The Dirichlet generating function for the matrix is zero for any pair c and s = 2 - c and any pair s and c = 2 - s except at the pole c = 1 and s = 1 where it is indeterminate.
In the Mathematica program section, in the expression for the matrix as Dirichlets characters, the variables s and c can apparently be any pair of positive integers.
Limits related to the Dirichlet generating function for the matrix: Let s = ZetaZero(n), then lim_{c->1} zeta(s*c)/zeta(c+s-1) = ZetaZero(n). Let s = ZetaZero(n), then lim_{c->1} zeta(s*c)/zeta(c+s*c-1) = ZetaZero(n)/(1+ZetaZero(n)).
(End)

Examples

			Array starts:
n\k | 1    2    3    4    5    6    7    8    9   10
----+-----------------------------------------------------
1   | 1,   1,   1,   1,   1,   1,   1,   1,   1,   1, ...
2   | 1,  -1,   1,  -1,   1,  -1,   1,  -1,   1,  -1, ...
3   | 1,   1,  -2,   1,   1,  -2,   1,   1,  -2,   1, ...
4   | 1,  -1,   1,  -1,   1,  -1,   1,  -1,   1,  -1, ...
5   | 1,   1,   1,   1,  -4,   1,   1,   1,   1,  -4, ...
6   | 1,  -1,  -2,  -1,   1,   2,   1,  -1,  -2,  -1, ...
7   | 1,   1,   1,   1,   1,   1,  -6,   1,   1,   1, ...
8   | 1,  -1,   1,  -1,   1,  -1,   1,  -1,   1,  -1, ...
9   | 1,   1,  -2,   1,   1,  -2,   1,   1,  -2,   1, ...
10  | 1,  -1,   1,  -1,  -4,  -1,   1,  -1,   1,   4, ...
		

Crossrefs

Programs

  • Mathematica
    T[ n_, k_] := T[ n, k] = Which[ n < 1 || k < 1, 0, n == 1 || k == 1, 1, k > n, T[k, n], n > k,T[k, Mod[n, k, 1]], True, -Sum[ T[n, i], {i, n - 1}]]; (* Michael Somos, Jul 18 2011 *)
    (* Conjectured expression for the matrix as Dirichlet characters *) s = RandomInteger[{1, 3}]; c = RandomInteger[{1, 3}]; nn = 12; b = Table[Exp[MangoldtLambda[Divisors[n]]]^-MoebiusMu[Divisors[n]], {n, 1, nn^Max[s, c]}]; j = 1; MatrixForm[Table[Table[Product[(b[[n^s]][[m]]*DirichletCharacter[b[[n^s]][[m]], j, k^c] - (b[[n^s]][[m]] - 1)), {m, 1, Length[Divisors[n]]}], {n, 1, nn}], {k, 1, nn}]] (* Mats Granvik, Nov 23 2013 and Aug 09 2016 *)
  • PARI
    {T(n, k) = if( n<1 || k<1, 0, n==1 || k==1, 1, k>n, T(k, n), kMichael Somos, Jul 18 2011 */
    
  • Python
    from sympy.core.cache import cacheit
    @cacheit
    def T(n, k): return 0 if n<1 or k<1 else 1 if n==1 or k==1 else T(k, n) if k>n else T(k, (n - 1)%k + 1) if n>k else -sum([T(n, i) for i in range(1, n)])
    for n in range(1, 21): print([T(k, n - k + 1) for k in range(1, n + 1)]) # Indranil Ghosh, Oct 23 2017

Formula

T(n,1)=1, T(1,k)=1, n>=k: -Sum_{i=1..k-1} T(n-i,k), n
T(n, n) = A023900(n). - Michael Somos, Jul 18 2011
T(n, k) = A023900(gcd(n,k)). - Mats Granvik, Jun 18 2012
Dirichlet generating function for sequence in the n-th row: zeta(s)*Sum_{ d divides n } mu(d)/d^(s-1). - Mats Granvik, Jun 18 2012 & Jun 19 2016
From Mats Granvik, Jun 19 2016: (Start)
Dirichlet generating function for the whole matrix: Sum_{k>=1} (Sum_{n>=1} T(n,k)/(n^c*k^s)) = Sum_{n>=1} (zeta(s)*Sum_{ d divides n } mu(d)/d^(s-1))/n^c = zeta(s)*zeta(c)/zeta( c + s - 1 ).
T(n,k) = A127093(n,k)^(1/2-i*a(k))*transpose(A008683(k)*(A127093(n,k)^(1/2+i*a(n)))) where a(x) is some real number. An example would be T(n,k) = A127093(n,k)^(zetazero(k))*transpose(A008683(k)*(A127093(n,k)^(zetazero(-k)))) but this is of course not special for only the zeta zeros.
Recurrence for a subset of A191898 that is a cross-directional variant of the recurrence in A051731: T(1,1)=1, T(1,2..k)=0, T(2..n,1)=0, n >= k: -Sum_{i=1..k-1} T(n-i,k) - T(n-i,k-1), n < k: -Sum_{i=1..n-1} T(k-i,n) - T(k-i,n-1). Notice that the identity matrix in linear algebra satisfies a similar recurrence:
T(1,1)=1, T(1,2..k)=0, T(2..n,1)=0, n >= k: -Sum_{i=1..n-1} T(n-i,k) - T(n-i,k-1), n < k: -Sum_{i=1..k-1} T(k-i,n) - T(k-i,n-1).
(End)
This array equals A051731*transpose(A143256). - Mats Granvik, Jul 22 2016
T(n,k) = sqrt(A143256(n,k))*transpose(sqrt(A143256(n,k))). - Mats Granvik, Aug 10 2018
Dirichlet generating function for absolute values: Sum_{k>=1} (Sum_{n>=1} abs(T(n,k))/(n^c*k^s)) = zeta(s)*zeta(c)*zeta(s + c - 1)/zeta(2*(s + c - 1))*Product_{k>=1} (1 - 2/(prime(k) + prime(k)^(s + c))). After Vaclav Kotesovec in A173557. - Mats Granvik, Apr 25 2021

A006992 Bertrand primes: a(n) is largest prime < 2*a(n-1) for n > 1, with a(1) = 2.

Original entry on oeis.org

2, 3, 5, 7, 13, 23, 43, 83, 163, 317, 631, 1259, 2503, 5003, 9973, 19937, 39869, 79699, 159389, 318751, 637499, 1274989, 2549951, 5099893, 10199767, 20399531, 40799041, 81598067, 163196129, 326392249, 652784471, 1305568919, 2611137817
Offset: 1

Keywords

Comments

a(n) < a(n+1) by Bertrand's postulate (Chebyshev's theorem). - Jonathan Sondow, May 31 2014
Let b(n) = 2^n - a(n). Then b(n) >= 2^(n-1) - 1 and b(n) is a B_2 sequence: 0, 1, 3, 9, 19, 41, 85, 173, 349, ... - Thomas Ordowski, Sep 23 2014 See the link for B_2 sequence.
These primes can be obtained of exclusive form using a restricted variant of Rowland's prime-generating recurrence (A106108), making gcd(n, a(n-1)) = -1 when GCDs are greater than 1 and less than n (see program). These GCDs are also a divisor of each odd number from a(n) + 2 to 2*a(n-1) - 1 in reverse order, so that this subtraction with -1's invariably leads to the prime. - Manuel Valdivia, Jan 13 2015
First row of array in A229607. - Robert Israel, Mar 31 2015
Named after the French mathematician Joseph Bertrand (1822-1900). - Amiram Eldar, Jun 10 2021

References

  • Martin Aigner and Günter M. Ziegler, Proofs from The Book, Springer-Verlag, Berlin, 1999; see p. 7.
  • Martin Griffiths, The Backbone of Pascal's Triangle, United Kingdom Mathematics Trust (2008), page 115. [From Martin Griffiths, Mar 28 2009]
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers. 3rd ed., Oxford Univ. Press, 1954, p. 344.
  • Ivan Niven and Herbert S. Zuckerman, An Introduction to the Theory of Numbers. 2nd ed., Wiley, NY, 1966, p. 189.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

See A185231 for another version.

Programs

  • Haskell
    a006992 n = a006992_list !! (n-1)
    a006992_list = iterate (a007917 . (* 2)) 2
    -- Reinhard Zumkeller, Sep 17 2014
    
  • Maple
    A006992 := proc(n) option remember; if n=1 then 2 else prevprime(2*A006992(n-1)); fi; end;
  • Mathematica
    bertrandPrime[1] = 2; bertrandPrime[n_] := NextPrime[ 2*a[n - 1], -1]; Table[bertrandPrime[n], {n, 40}]
    (* Second program: *)
    NestList[NextPrime[2#, -1] &, 2, 40] (* Harvey P. Dale, May 21 2012 *)
    k = 3; a[n_] := If[GCD[n,k] > 1 && GCD[n, k] < n, -1, GCD[n, k]]; Select[Differences@Table[k = a[n] + k, {n, 2611137817}], # > 1 &] (* Manuel Valdivia, Jan 13 2015 *)
  • PARI
    print1(t=2);for(i=2,60,print1(", "t=precprime(2*t))) \\ Charles R Greathouse IV, Apr 01 2013
    
  • Python
    from sympy import prevprime
    l = [2]
    for i in range(1, 51):
        l.append(prevprime(2 * l[i - 1]))
    print(l) # Indranil Ghosh, Apr 26 2017

Formula

a(n+1) = A007917(2*a(n)). - Reinhard Zumkeller, Sep 17 2014
Limit_{n -> infinity} a(n)/2^n = 0.303976447924... - Thomas Ordowski, Apr 05 2015

Extensions

Definition completed by Jonathan Sondow, May 31 2014
B_2 sequence link added by Wolfdieter Lang, Oct 09 2014

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

Original entry on oeis.org

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

Keywords

Comments

All runs end in even numbers at a(p), new highs are found at A000101 and the increasing gap size is A005250. - Robert G. Wilson v, Dec 07 2001
All terms are positive since here the variant 2 (A151799(n) < n) of the prevprime function is used, rather than the variant 1 (A007917(n) <= n). - M. F. Hasler, Sep 09 2015

Programs

  • Maple
    A049711 := n-> n-prevprime(n);
  • Mathematica
    PrevPrim[n_] := Block[ {k = n - 1}, While[ !PrimeQ[k], k-- ]; Return[k]]; Table[ n - PrevPrim[n], {n, 3, 100} ]
    Array[#-NextPrime[#,-1]&,100,3] (* Harvey P. Dale, Dec 07 2011 *)
  • PARI
    A049711(n)=n-precprime(n-1) \\ M. F. Hasler, Sep 09 2015

Formula

a(n) = A064722(n-1) + 1. - Pontus von Brömssen, Jul 31 2022

A013603 Difference between 2^n and the nearest prime less than or equal to 2^n.

Original entry on oeis.org

0, 1, 1, 3, 1, 3, 1, 5, 3, 3, 9, 3, 1, 3, 19, 15, 1, 5, 1, 3, 9, 3, 15, 3, 39, 5, 39, 57, 3, 35, 1, 5, 9, 41, 31, 5, 25, 45, 7, 87, 21, 11, 57, 17, 55, 21, 115, 59, 81, 27, 129, 47, 111, 33, 55, 5, 13, 27, 55, 93, 1, 57, 25, 59, 49, 5, 19, 23, 19, 35, 231, 93, 69, 35, 97, 15
Offset: 1

Author

James Kilfiger (mapdn(AT)csv.warwick.ac.uk)

Keywords

Comments

If a(n) = 1, then n is prime and 2^n - 1 is a Mersenne prime. - Franz Vrabec, Sep 27 2005
Using the first variant A007917 (rather than A151799) of the prevprime() function, the sequence is well defined for n = 1, with a(1) = 2^1 - prevprime(2^1) = 2 - 2 = 0. - M. F. Hasler, Sep 09 2015
In Mathematica, one can use NextPrime with a second argument of -1 to obtain the next smaller prime. As almost all the powers of 2 are composite, this produces the proper results for most of this sequence. However, NextPrime[2, -1] returns -2 rather than the expected 2, which would consequently mean a(1) = 4 rather than 0. - Alonso del Arte, Dec 10 2016

Crossrefs

Equivalent sequence for next prime: A092131.

Programs

  • Maple
    seq(2^i-prevprime(2^i),i=2..100);
  • Mathematica
    {0} ~Join~ Array[With[{c = 2^#}, c - NextPrime[c, -1]] &, 80, 2] (* Harvey P. Dale, Jul 23 2013 *)
    Table[2^n - Prime[PrimePi[2^n]], {n, 80}] (* Alonso del Arte, Dec 10 2016 *)
  • PARI
    a(n) = 2^n - precprime(2^n); \\ Michel Marcus, Apr 04 2020

Formula

a(n) = A049711(2^n). - R. J. Mathar, Nov 28 2016
a(n) = 2^n - prevprime(2^n) = 2^n - prime(primepi(2^n)). - Alonso del Arte, Dec 10 2016

Extensions

Extended to a(1) = 0 by M. F. Hasler, Sep 09 2015

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

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

A104350 Partial products of largest prime factors of numbers <= n.

Original entry on oeis.org

1, 2, 6, 12, 60, 180, 1260, 2520, 7560, 37800, 415800, 1247400, 16216200, 113513400, 567567000, 1135134000, 19297278000, 57891834000, 1099944846000, 5499724230000, 38498069610000, 423478765710000, 9740011611330000
Offset: 1

Author

Reinhard Zumkeller, Mar 06 2005

Keywords

Comments

Partial Products of A006530: a(n) = Product_{k=1..n} A006530(k).
a(n) = a(n-1)*A006530(n) for n>1, a(1) = 1;
A020639(a(n)) = A040000(n-1), A006530(a(n)) = A007917(n) for n>1.
A001221(a(n)) = A000720(n), A001222(a(n)) = A001477(n-1).
A007947(a(n)) = A034386(n).
a(n) = A000142(n) / A076928(n). [Corrected by Franklin T. Adams-Watters, Oct 30 2006]
In decimal representation: A104351(n) = number of digits of a(n), A104355(n) = number of trailing zeros of a(n).
A104357(n) = a(n) - 1, A104365(n) = a(n) + 1.

References

  • Gérald Tenenbaum, Introduction à la théorie analytique et probabiliste des nombres, Publ. Inst. Elie Cartan, Vol. 13, Nancy, 1990.

Programs

  • Haskell
    a104350 n = a104350_list !! (n-1)
    a104350_list = scanl1 (*) a006530_list
    -- Reinhard Zumkeller, Apr 10 2014
    
  • Mathematica
    A104350[n_] := Product[FactorInteger[k][[-1, 1]], {k, 1, n}]; Table[A104350[n], {n, 30}] (* G. C. Greubel, May 09 2017 *)
    FoldList[Times,Table[FactorInteger[n][[-1,1]],{n,30}]] (* Harvey P. Dale, May 25 2023 *)
  • PARI
    gpf(n)=my(f=factor(n)[,1]); f[#f]
    a(n)=prod(i=2,n,gpf(i)) \\ Charles R Greathouse IV, Apr 29 2015
    
  • PARI
    first(n)=my(v=vector(n,i,1)); forfactored(k=2,n, v[k[1]]=v[k[1]-1]*vecmax(k[2][,1])); v \\ Charles R Greathouse IV, May 10 2017

Formula

log(a(n)) = c * n * log(n) + c * (1-gamma) * n + O(n * exp(-log(n)^(3/8-eps))), where c is the Golomb-Dickman constant (A084945) and gamma is Euler's constant (A001620) (Tenenbaum, 1990). - Amiram Eldar, May 21 2021

Extensions

More terms from David Wasserman, Apr 24 2008

A053001 Largest prime < n^2.

Original entry on oeis.org

3, 7, 13, 23, 31, 47, 61, 79, 97, 113, 139, 167, 193, 223, 251, 283, 317, 359, 397, 439, 479, 523, 571, 619, 673, 727, 773, 839, 887, 953, 1021, 1087, 1153, 1223, 1291, 1367, 1439, 1511, 1597, 1669, 1759, 1847, 1933, 2017, 2113, 2207, 2297, 2399, 2477, 2593
Offset: 2

Author

N. J. A. Sloane, Feb 21 2000

Keywords

Comments

Suggested by Legendre's conjecture (still open) that there is always a prime between n^2 and (n+1)^2.
Legendre's conjecture is equivalent to a(n) > (n-1)^2. - John W. Nicholson, Dec 11 2013

References

  • J. R. Goldman, The Queen of Mathematics, 1998, p. 82.

Crossrefs

Programs

  • Haskell
    a053001 = a007917 . a000290  -- Reinhard Zumkeller, Jun 07 2015
    
  • Maple
    [seq(prevprime(i^2),i=2..100)];
  • Mathematica
    Table[Prime[PrimePi[n^2]], {n, 2, 60}] (* Stefan Steinerberger, Apr 01 2006 *)
    Table[NextPrime[n^2, -1], {n, 2, 60}] (* Jean-François Alcover, Oct 14 2013 *)
  • PARI
    a(n) = precprime(n^2) \\ Michel Marcus, Oct 14 2013
    
  • Python
    from sympy import prevprime
    def a(n):  return prevprime(n*n)
    print([a(n) for n in range(2, 52)]) # Michael S. Branicky, Jul 29 2022

Formula

a(n) = A007917(A000290(n)). - Reinhard Zumkeller, Jun 07 2015

Extensions

More terms from James Sellers, Feb 22 2000
Previous Showing 11-20 of 133 results. Next