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

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

A325142 a(n) = k if (n - k, n + k) is the centered Goldbach partition of 2n if it exists and -1 otherwise.

Original entry on oeis.org

-1, -1, 0, 0, 1, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 3, 0, 1, 0, 3, 2, 9, 0, 5, 6, 3, 4, 9, 0, 1, 0, 9, 4, 3, 6, 5, 0, 9, 2, 3, 0, 1, 0, 3, 2, 15, 0, 5, 12, 3, 8, 9, 0, 7, 12, 3, 4, 15, 0, 1, 0, 9, 4, 3, 6, 5, 0, 15, 2, 3, 0, 1, 0, 15, 4, 3, 6, 5, 0, 9, 2, 15, 0
Offset: 0

Views

Author

Peter Luschny, May 02 2019

Keywords

Comments

Let N = 2*n = p + q where p and q are primes. We call such a pair (p, q) a Goldbach partition of N. A centered Goldbach partition is the Goldbach partition of the form (n - k, n + k) where k >= 0 is minimal. If N has a centered Goldbach partition then a(n) is this k and otherwise -1.
According to Goldbach's conjecture, any even N = 2n > 2 has a Goldbach partition, which is necessarily of the form p = n - k, q = n + k: namely, with n = (p+q)/2 and k = (q-p)/2. - M. F. Hasler, May 02 2019

Examples

			a(162571) = 78 because 325142 = 162493 + 162649 and there is no k, 0 <= k < 78, such that (162571 - k, 162571 + k) is a Goldbach partition of 325142.
		

Crossrefs

Programs

  • Maple
    a := proc(n) local k; for k from 0 to n do
    if isprime(n + k) and isprime(n - k) then return k fi od: -1 end:
    seq(a(n), n=0..83);
  • Mathematica
    a[n_] := Module[{k}, For[k = 0, k <= n, k++, If[PrimeQ[n+k] && PrimeQ[n-k], Return[k]]]; -1]; Table[a[n], {n, 0, 83}] (* Jean-François Alcover, Jul 06 2019, from Maple *)
  • PARI
    a(n) = for(k=0, n, if(ispseudoprime(n+k) && ispseudoprime(n-k), return(k))); -1 \\ Felix Fröhlich, May 02 2019
    
  • PARI
    apply( A325142(n)=-!forprime(p=n,2*n, isprime(n*2-p)&&return(p-n)), [0..99]) \\ M. F. Hasler, May 02 2019

Formula

a(n) = n - A112823(n) = A234345(n) - n (= n - A002374(n) for n > 2). - M. F. Hasler, May 02 2019
a(n) = A047160(n) = A066285(n)/2 for n >= 2. - Alois P. Heinz, Jun 01 2020

A104772 If n<=2 then n else (if n is odd then 2*a(n+1) else p*q, where n=p+q, p<=q, primes).

Original entry on oeis.org

1, 2, 8, 4, 18, 9, 30, 15, 42, 21, 70, 35, 66, 33, 78, 39, 130, 65, 102, 51, 114, 57, 190, 95, 138, 69, 230, 115, 322, 161, 174, 87, 186, 93, 310, 155, 434, 217, 222, 111, 370, 185, 246, 123, 258, 129, 430, 215, 282, 141, 470, 235, 658, 329, 318, 159, 530, 265, 742
Offset: 1

Views

Author

Reinhard Zumkeller, Mar 24 2005

Keywords

Comments

Encoding of positive integers based on the Goldbach conjecture, see A104774 for decoding: A104774(A104772(n))=n;
a(n - n mod 2) = (2^(1 + n mod 2)) * A020481(floor(n/2))*A020482(floor(n/2));
for numbers greater than 4: a(even) = odd and a(odd) = even;
A001222(a(n)) = A010693(n) for n>2;
a(a(n)) = A104773(n).

Crossrefs

Formula

For k>1: a(2*k)=A020481(k)*A020482(k) and a(2*k-1)=2*a(2*k).

A377972 a(n) is the greatest i such that 2n-prime(i) is also a prime, where prime(i) is the i-th prime.

Original entry on oeis.org

1, 2, 3, 4, 4, 5, 6, 6, 7, 8, 8, 9, 9, 9, 10, 11, 11, 11, 12, 12, 13, 14, 14, 15, 15, 15, 16, 16, 16, 17, 18, 18, 18, 19, 19, 20, 21, 21, 21, 22, 22, 23, 23, 23, 24, 24, 24, 22, 25, 25, 26, 27, 27, 28, 29, 29, 30, 30, 30, 29, 30, 30, 29, 31, 31, 32
Offset: 2

Views

Author

Keywords

Examples

			For n=2, 2*2 - 2 = 2 and pi(2) = 1.
For n=3, 2*3 - 3 = 3, pi(3)=2.
		

Crossrefs

Programs

  • Mathematica
    Table[Max[PrimePi[Flatten[Select[IntegerPartitions[2 n, {2}], AllTrue[#, PrimeQ] &]]]], {n, 2, 101}]
  • PARI
    a(n) = forprime(q=2, n, if(isprime(2*n-q), return(primepi(2*n-q)))); \\ Michel Marcus, Nov 16 2024

Formula

a(n) = A000720(A020482(n)).
prime(a(n)) + prime(A377758(n)) = 2*n.

A159482 Greatest odd prime q < 2*n such that p < q and p prime and p = 2*n - q or 0 if no such prime exists.

Original entry on oeis.org

0, 0, 0, 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, 79, 97, 97, 101, 103, 103, 107, 109, 109, 113, 113, 113, 109, 113, 113, 109, 127, 127
Offset: 1

Views

Author

Pierre CAMI, Apr 14 2009

Keywords

Comments

q + p = 2*n and p*q = ((q+p)/2)^2 - ((q-p)/2)^2 = n^2 - ((q-p)/2)^2.
Essentially the same as A020482. - R. J. Mathar, Oct 24 2009

A210957 Prime pair (p, q), p<=q, such that p + q = 2*n and p*q is the minimal product.

Original entry on oeis.org

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

Views

Author

Omar E. Pol, Jun 29 2012

Keywords

Comments

A020481 and A020482 interleaved.

Examples

			-----------------------------------
                 2*n    A073046(n)
       Pair       =         =
n     (p, q)     p+q       p*q
-----------------------------------
2     (2, 2)      4          4
3     (3, 3)      6          9
4     (3, 5)      8         15
5     (3, 7)     10         21
6     (5, 7)     12         35
7     (3, 11)    14         33
8     (3, 13)    16         39
9     (5, 13)    18         65
10    (3, 17)    20         51
11    (3, 19)    22         57
12    (5, 19)    24         95
		

Crossrefs

Formula

p_n = A020481(n), n >= 2.
q_n = A020482(n), n >= 2.
p_n + q_n = 2*n, n >= 2.
p_n * q_n = A073046(n), n >= 2.

A234649 Difference between the first members of the widest and the narrowest prime pair having an arithmetic mean of n.

Original entry on oeis.org

2, 2, 4, 2, 6, 4, 6, 6, 10, 8, 12, 0, 14, 14, 10, 14, 14, 16, 18, 16, 16, 12, 22, 16, 20, 24, 24, 26, 26, 28, 26, 32, 30, 26, 36, 16, 36, 36, 28, 36, 36, 18, 44, 38, 40, 44, 42, 40, 50, 48, 40, 42, 52, 30, 42, 46, 42, 56, 56, 58, 48, 60, 64, 56, 66, 60, 48, 60, 70, 68, 68, 54, 68, 74, 60, 56
Offset: 8

Views

Author

Ralf Stephan, Dec 29 2013

Keywords

Comments

The widest prime pair with a mean of n is (A002373(n),A020482(n)) and the narrowest is (A078587(n),A078496(n)).
Existence of a(n) for all n depends on A061357(n) > 0.
Even numbers missing in the subsequence with n<10^5 are 34,62,82,88,112,116,118,122,130,140,152...
a(n) = 0 for n=4,5,6,7,19 because A061357(n) = 1.

Examples

			The prime pairs with an arithmetic mean of 18 are (17,19), (13,23), (7,29), and (5,31), so a(18) = 17-5 = 31-19 = 12. The only pair with mean of 19 is (7,31) so a(19) = 0.
		

Crossrefs

Cf. A045917.

Programs

  • PARI
    a(n)=mi=0;ma=0;forprime(p=3,n-1,if(isprime(2*n-p),if(!mi,mi=2*n-p);ma=2*n-p));if(!ma,-1,mi-ma)

Formula

a(n) = A078587(n) - A002373(n) = A078496(n) - A020482(n).

A255274 From Goldbach conjecture: Consider the pairs (2n-+1, 3), (2n-1, 5), (2n-3, 7), ..., (3, 2n+1) of odd numbers having sum 2n+4; a(n) is the index of the first pair of primes (p, q) on the list.

Original entry on oeis.org

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

Views

Author

Michel Lagneau, Feb 20 2015

Keywords

Comments

a(n) = A049847(n) for n = 1..46. The values of n such that a(n) is different from A049847(n) are 47, 59, 62, 72, 93, 102, 108, 123, 144, 149, 152, 161, 164, 171, 182, 197, 203, 207, 213, 227, ...
The corresponding pairs of primes are (3, 3), (3, 5), (3, 7), (5, 7), (3, 11), (3, 13), (5, 13), (3, 17), ... (A210957).

Examples

			a(13)=3 because 2*13 + 4 = 30 => 13 pairs (27,3), (25,5), (23,7), ..., (3,27) and the pair (23,7) is the third pair having prime elements.
		

Crossrefs

Programs

  • Maple
    nn:=100:for n from 6 by 2 to nn do:ii:=0:it:=1:for p from 3 by 2 to n while(ii=0) do:if type(n-p,prime)=true and type(p,prime)=true then ii:=1: printf(`%d, `,it):else it:=it+1:fi:od:od:
  • PARI
    a(n)=my(m=2*n+4); forprime(q=3, n+2, if(isprime(m-q), return(q\2))) \\ Charles R Greathouse IV, Jan 07 2022

Formula

a(n) = n + (3-A020482(n+2))/2 = (A020481(n+2)-1)/2 via the Maiga link. - Bill McEachen, Jan 02 2022

Extensions

Edited by N. J. A. Sloane, Sep 12 2017

A317595 a(n) is the number of primes between 2n and the largest prime p such that 2n-p is also a prime.

Original entry on oeis.org

1, 1, 1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 3, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 2, 0, 1, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0
Offset: 2

Views

Author

Lei Zhou, Aug 01 2018

Keywords

Comments

If the Goldbach Conjecture is true, this sequence is defined for n >= 2.

Examples

			For n=2, 2n=4 = 2+2, there is one prime, which is 3, between 2 and 4. So a(2)=1;
...
For n=8, 2n=16 = 13+3, there is no prime between 13 and 16. So a(8)=0;
...
For n=49, 2n=98 = 79+19, there are three primes, 83, 89, and 97 between 79 and 98 such that the difference of 98 and these primes, 15, 9, and 1 respectively, are not prime. So a(49)=3.
		

Crossrefs

Programs

  • Mathematica
    Table[n2 = n*2; p = NextPrime[n2]; ct = 0; While[p = NextPrime[p, -1]; ! PrimeQ[n2 - p], ct++]; ct, {n, 2, 88}]

Formula

a(n) = A000720(A020482(n)) - A020482(2*n). - Michel Marcus, Aug 02 2018

A375358 a(n) is the greatest difference between m and k, with m, k both prime such that k + m = p + q, where (p, q) is the n-th twin prime pair.

Original entry on oeis.org

2, 2, 14, 26, 46, 74, 106, 134, 194, 206, 266, 286, 346, 374, 382, 442, 454, 506, 550, 614, 686, 818, 854, 914, 1034, 1118, 1186, 1226, 1274, 1294, 1606, 1630, 1618, 1702, 1754, 2018, 2042, 2078, 2102, 2174, 2290, 2434, 2546, 2534, 2582, 2626, 2846, 2890, 2950
Offset: 1

Views

Author

Gonzalo Martínez, Aug 13 2024

Keywords

Comments

If p and q are twin primes and x is their average, then among all pairs of primes (k, m) such that |x - k| = |x - m|, it is observed that p and q are at the smallest distance from x, which is 1. Our interest lies in finding the pair (m, k) such that the distance to x is maximum and then determining |k - m|.

Examples

			Since the 3rd pair of twin primes is (11, 13), whose sum is 24, and the other pairs of primes that sum to 24 are (5, 19) and (7, 17), the greatest difference is 19 - 5 = 14. Therefore, a(3) = 14.
		

Crossrefs

Programs

  • Python
    from itertools import islice
    from sympy import isprime, nextprime, primerange
    def agen(): # generator of terms
        p, q = 2, 3
        while True:
            if q - p == 2:
                s = p + q
                yield max(m-k for k in primerange(2, s//2+1) if isprime(m:=s-k))
            p, q = q, nextprime(q)
    print(list(islice(agen(), 80))) # Michael S. Branicky, Aug 13 2024
Previous Showing 21-30 of 32 results. Next