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 11 results. Next

A083060 a(n) is the number of natural numbers k such that A078496(k) = prime(n), where prime(n) denotes the n-th prime.

Original entry on oeis.org

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

Views

Author

Serhat Sevki Dincer (sevki(AT)ug.bilkent.edu.tr), Apr 18 2003

Keywords

Examples

			a(3)=1 since there is only k=4 for A078496(k) = prime(3) = 5.
a(8)=3 since there is only k=13,16,18 for A078496(k) = prime(8) = 19.
		

Crossrefs

Cf. A078496.

Programs

  • PARI
    A078496(n) = {my(p=nextprime(n+1)); while(!isprime(2*n-p), p = nextprime(p+1)); p; }
    first(n) = { my(res=vector(n)); for(x=4, prime(n), my(r=primepi(A078496(x))); if(r <= n, res[r]++)); res; } \\ Iain Fox, Nov 23 2017

Formula

For n > 2, a(n) = card({k: k > 3; A078496(k) = prime(n)}).

Extensions

a(1) and a(2) prepended by Iain Fox, Nov 23 2017
More terms from Iain Fox, Nov 23 2017

A277583 Goldbach's problem extended to squares of prime gaps (>=2): smallest integer >= ((A078587(n) - A078496(n))^2)/n for n >= 4.

Original entry on oeis.org

1, 4, 1, 10, 5, 2, 4, 14, 1, 12, 3, 2, 3, 9, 1, 31, 2, 1, 15, 7, 5, 6, 2, 3, 12, 20, 1, 19, 11, 2, 2, 5, 3, 4, 9, 1, 1, 15, 1, 54, 1, 1, 20, 4, 3, 12, 1, 6, 7, 3, 4, 11, 1, 2, 16, 10, 1, 22, 6, 2, 1, 3, 2, 3, 14, 1, 1, 9, 1, 2, 13, 1, 1, 2, 2, 17, 5, 1, 11, 28, 2, 7, 1, 10, 4, 15
Offset: 4

Views

Author

Juri-Stepan Gerasimov, Oct 22 2016

Keywords

Comments

Where A078587(n) + A078496(n) = 2n and A078587(n) < A078496(n).

Examples

			a(5) = 4 because ((A078587(5) - A078496(5))^2)/5 = ((3 - 7)^2)/5 < 4, where 3 (prime) = 7 (prime) = 2*5;
a(6) = 1 because ((A078587(6) - A078496(6))^2)/6 = ((5 - 7)^2)/6 < 1, where 5 (prime) + 7 (prime) = 2*6;
a(7) = 10 because ((A078587(7) - A078496(7))^2)/7 = ((3 - 11)^2)/7 < 10, where 3 (prime) + 11 (prime) = 2*7.
		

Crossrefs

Cf. A002375, A078496, A078587, A277581 (Goldbach's problem extended to squares of prime gaps >= 0).

Programs

  • Mathematica
    Table[k = 1; While[k < ((Last@ # - First@ #)^2)/n, k++] &@ Block[{p = n + 1, q}, q = 2 n - p; While[q > 0 && Nand[PrimeQ@ p, PrimeQ@ q], p++; q--]; {p, q}]; k, {n, 4, 89}] (* or *)
    Table[Ceiling[4 (n - #)^2/n] &@ Block[{p = n + 1, q}, q = 2 n - p; While[q > 0 && Nand[PrimeQ@ p, PrimeQ@ q], p++; q--]; p], {n, 4, 89}] (* Michael De Vlieger, Oct 26 2016, after T. D. Noe at A078587 and Michel Marcus PARI *)
  • PARI
    maxp(n) = {my(p = precprime(n-1)); while(!isprime(2*n-p), p = precprime(p-1)); p;}
    a(n) = ceil(4*(n - maxp(n))^2/n); \\ Michel Marcus, Oct 22 2016

A083059 a(n) is the number of natural numbers k such that A078496(k)=n.

Original entry on oeis.org

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

Views

Author

Serhat Sevki Dincer (sevki(AT)ug.bilkent.edu.tr), Apr 18 2003

Keywords

Examples

			a(19)=3 since there are only k=13,16,18 for which A078496(k)=19
		

Crossrefs

Cf. A078496.

Programs

  • PARI
    b(n)={forprime(p=nextprime(n+1), 2*n, if(isprime(2*n-p), return(p))); 0}
    a(n)={if(isprime(n), sum(i=n\2+1, n-1, b(i)==n), 0)} \\ Andrew Howroyd, Nov 06 2019

Formula

a(n) = #{k: k>3 integer; A078496(k)=n}.

Extensions

Terms a(24) and beyond from Andrew Howroyd, Nov 06 2019

A082467 Least k>0 such that n-k and n+k are both primes.

Original entry on oeis.org

1, 2, 1, 4, 3, 2, 3, 6, 1, 6, 3, 2, 3, 6, 1, 12, 3, 2, 9, 6, 5, 6, 3, 4, 9, 12, 1, 12, 9, 4, 3, 6, 5, 6, 9, 2, 3, 12, 1, 24, 3, 2, 15, 6, 5, 12, 3, 8, 9, 6, 7, 12, 3, 4, 15, 12, 1, 18, 9, 4, 3, 6, 5, 6, 15, 2, 3, 12, 1, 6, 15, 4, 3, 6, 5, 18, 9, 2, 15, 24, 5, 12, 3, 14, 9, 18, 7, 12, 9, 4, 15, 6, 7, 30, 9
Offset: 4

Views

Author

Benoit Cloitre, Apr 27 2003

Keywords

Comments

The existence of k>0 for all n >= 4 is equivalent to the strong Goldbach Conjecture that every even number >= 8 is the sum of two distinct primes.
n and k are coprime, because otherwise n + k would be composite. So the rational sequence r(n) = a(n)/n = k/n is injective. - Jason Kimberley, Sep 21 2011
Because there are arbitrarily many composites from m!+2 to m!+m, there are also arbitrarily large a(n) but they increase very slowly. The twin prime conjecture implies that infinitely many a(n) are 1. - Juhani Heino, Apr 09 2020

Examples

			n=10: k=3 because 10-3 and 10+3 are both prime and 3 is the smallest k such that n +/- k are both prime.
		

Crossrefs

Cf. A129301 (records), A129302 (where records occur).
Cf. A047160 (allows k=0).
Cf. A078611 (subset for prime n).

Programs

  • Magma
    A082467 := func; [A082467(n):n in [4..98]]; // Jason Kimberley, Sep 03 2011
  • Maple
    A082467 := proc(n) local k; k := 1+irem(n,2);
    while n > k do if isprime(n-k) then if isprime(n+k)
    then RETURN(k) fi fi; k := k+2 od; print("Goldbach erred!") end:
    seq(A082467(i),i=4..90); # Peter Luschny, Sep 21 2011
  • Mathematica
    f[n_] := Block[{k}, If[OddQ[n], k = 2, k = 1]; While[ !PrimeQ[n - k] || !PrimeQ[n + k], k += 2]; k]; Table[ f[n], {n, 4, 98}] (* Robert G. Wilson v, Mar 28 2005 *)
  • PARI
    a(n)=if(n<0,0,k=1; while(isprime(n-k)*isprime(n+k) == 0,k++); k)
    

Formula

A078496(n)-a(n) = A078587(n)+a(n) = n.

Extensions

Entries checked by Klaus Brockhaus, Apr 08 2007

A078587 Largest prime p such that p

Original entry on oeis.org

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

Views

Author

T. D. Noe, Dec 02 2002

Keywords

Comments

Suggested by Goldbach Conjecture.
Also, values of p from A143697. This follows from the factorization n^2-k^2 = (n-k)(n+k). - T. D. Noe, Jan 22 2009

Crossrefs

Programs

  • Mathematica
    Table[p=n+1; q=2n-p; While[q>0&&!(PrimeQ[p]&&PrimeQ[q]), p++; q-- ]; q, {n, 4, 100}]
  • PARI
    a(n) = {my(p = precprime(n-1)); while(!isprime(2*n-p), p = precprime(p-1)); p;} \\ Michel Marcus, Oct 22 2016

Formula

a(n) = 2n - A078496(n)

Extensions

Edited by N. J. A. Sloane, Jan 24 2009 at the suggestion of R. J. Mathar and T. D. Noe.

A078497 The member r of a triple of primes (p,q,r) in arithmetic progression which sum to 3*prime(n) = A001748(n) = p + q + r.

Original entry on oeis.org

7, 11, 17, 19, 23, 31, 29, 41, 43, 43, 53, 67, 53, 59, 71, 79, 73, 83, 79, 97, 107, 107, 127, 113, 109, 113, 139, 137, 151, 149, 167, 151, 167, 163, 163, 199, 197, 179, 191, 199, 233, 223, 227, 241, 223, 283, 257, 277, 239, 251, 271, 263, 263, 269, 281, 313
Offset: 3

Views

Author

Serhat Sevki Dincer (sevki(AT)ug.bilkent.edu.tr), Nov 27 2002

Keywords

Comments

In case more than one triple of primes p, q=p+d and r=p+2*d exists, we take r=a(n) from the triple with the smallest d. This shows the difference from A092940, which would take the maximum r over all triples. - R. J. Mathar, May 19 2007

Examples

			a(1) = 7 because 3+5+7 = 15;
a(2) = 11 because 3+7+11 = 21;
a(3) = 17 because 5+11+17= 33.
		

Crossrefs

Programs

  • Maple
    A078497 := proc(n) local p3, i,d,r,p; p3 := ithprime(n) ; i := n+1 ; while true do r := ithprime(i) ; d := r-p3 ; p := p3-d ; if isprime(p) then RETURN(r) ; fi ; i := i+1 ; od ; RETURN(-1) ; end: for n from 3 to 60 do printf("%d, ",A078497(n)) ; od ; # R. J. Mathar, May 19 2007
  • Mathematica
    f[n_] := Block[{p = Prime[n], k}, k = p + 1; While[ !PrimeQ[k] || !PrimeQ[2p - k], k++ ]; k]; Table[ f[n], {n, 3, 60}]

Extensions

Edited and extended by Robert G. Wilson v, Nov 29 2002
Further edited by N. J. A. Sloane, Jul 03 2008 at the suggestion of R. J. Mathar

A063748 Greatest x that is a solution to x-phi(x)=n or zero if there is no solution, where phi(x) is Euler's totient function.

Original entry on oeis.org

4, 9, 8, 25, 10, 49, 16, 27, 0, 121, 22, 169, 26, 55, 32, 289, 34, 361, 38, 85, 30, 529, 46, 133, 0, 187, 52, 841, 58, 961, 64, 253, 0, 323, 68, 1369, 74, 391, 76, 1681, 82, 1849, 86, 493, 70, 2209, 94, 589, 0, 667, 0, 2809, 106, 703, 104, 697, 0, 3481, 118, 3721, 122
Offset: 2

Views

Author

Labos Elemer, Aug 13 2001

Keywords

Comments

See A051953 for x-phi(x), the cototient function. Note that a(n)=0 for n in A005278. Also note that n=1 has an infinite number of solutions. If n is prime, then a(n)=n^2. If n is even, then a(n)<=2n. In particular, if n=p+1 for a prime p, then a(n)=2n-2. Also, if n=2^k, then a(n)=2n. If n>9 is odd and composite, then a(n)=pq, with p>q odd primes with p+q=n+1 and p-q minimal. We can take p=A078496((n+1)/2) and q=A078587((n+1)/2).

Examples

			For n=15, the solutions are x=39 and x=55, so a(15)=55. Note that 55=5*11 and 5+11=n+1.
		

Crossrefs

Cf. A063507 (least solution to x-phi(x)=n), A063740 (number of solutions to x-phi(x)=n).

Programs

  • Mathematica
    nn=10^4; lim=Floor[Sqrt[nn]]; mx=Table[0,{lim}]; Do[c=n-EulerPhi[n]; If[0T. D. Noe *)
    Table[Module[{k = n^2}, While[And[k - EulerPhi@ k != n, k > 0], k--];
    k], {n, 2, 62}] (* Michael De Vlieger, Mar 17 2017 *)

Formula

a(n)=Max{x : A051953(x)=n} if the inverse set is not empty; a(n)=0 if no inverse exists.

Extensions

Corrected and edited by T. D. Noe, Oct 30 2006

A078498 Let q(n) be the prime defined in A078497; sequence gives (q(n)-prime(n))/6.

Original entry on oeis.org

1, 1, 1, 2, 1, 2, 2, 1, 2, 4, 1, 1, 2, 3, 1, 2, 1, 3, 4, 3, 5, 2, 1, 1, 5, 4, 4, 3, 5, 2, 3, 2, 1, 6, 5, 1, 2, 3, 7, 5, 5, 7, 2, 10, 5, 8, 1, 2, 5, 2, 1, 1, 2, 7, 1, 2, 9, 4, 4, 7, 6, 6, 3, 5, 6, 3, 1, 7, 5, 1, 5, 6, 5, 4, 3, 2, 5, 2, 2, 4, 3, 4, 3, 14, 3, 4, 4, 2, 9, 2, 7, 9, 8, 7, 4, 13
Offset: 5

Views

Author

Serhat Sevki Dincer (sevki(AT)ug.bilkent.edu.tr), Nov 27 2002

Keywords

Examples

			a(6)=1, a(25)=5.
		

Crossrefs

Programs

  • Mathematica
    Table[p = Prime[i]; j = 0; While[j++; df = 6*j; ! ((PrimeQ[p + df]) && (PrimeQ[p - df]))]; j, {i, 5, 100}]

Formula

For n>4 a(n)=( min{p : p>prime(n), p and 2*prime(n)-p are primes} - prime(n) ) / 6.

Extensions

More terms from Pab Ter (pabrlos(AT)yahoo.com), May 27 2004

A143697 Least square k^2 such that n^2-k^2 = p*q with p and q odd primes and p= 4.

Original entry on oeis.org

1, 4, 1, 16, 9, 4, 9, 36, 1, 36, 9, 4, 9, 36, 1, 144, 9, 4, 81, 36, 25, 36, 9, 16, 81, 144, 1, 144, 81, 16, 9, 36, 25, 36, 81, 4, 9, 144, 1, 576, 9, 4, 225, 36, 25, 144, 9, 64, 81, 36, 49, 144, 9, 16, 225, 144, 1, 324, 81, 16, 9, 36, 25, 36, 225, 4, 9, 144, 1, 36, 225
Offset: 4

Views

Author

Pierre CAMI, Aug 29 2008

Keywords

Comments

The product p*q is the sum of p consecutive odd numbers with 2*n-1 the greatest.
For n=4 p*q=3*5=15, 15=7+5+3
For n=5 p*q=3*7=21, 21=9+7+5
For n=6 p*q=5*7=35, 35=11+9+7+5+3
For n=7 p*q=3*11=33, 33=13+11+9
k^2 is the sum of the k first consecutive odd numbers p=n-k and q=n+k.
Assuming a strong version of the Goldbach conjecture, every term exists and we have a(n)=A082467(n)^2, p(n)=A078587(n) and q(n)=A078496(n). [T. D. Noe, Jan 22 2009]

Examples

			4*4-1=3*5 p=3 q=5
5*5-4=3*7 p=3 q=7
6*6-1=5*7 p=5 q=7
7*7-16=3*11 p=3 q=11
		

Crossrefs

Programs

  • PARI
    a(n) = {for (k=1, n-1, my(x=n^2-k^2); if ((omega(x)==2) && (bigomega(x)==2) && (x%2), return(k^2);););} \\ Michel Marcus, Sep 23 2019

A305883 Triangle read by rows: row n lists the pairs (p, q) such that p, q are primes, p+q=2*n and p < q.

Original entry on oeis.org

3, 5, 3, 7, 5, 7, 3, 11, 3, 13, 5, 11, 5, 13, 7, 11, 3, 17, 7, 13, 3, 19, 5, 17, 5, 19, 7, 17, 11, 13, 3, 23, 7, 19, 5, 23, 11, 17, 7, 23, 11, 19, 13, 17, 3, 29, 13, 19, 3, 31, 5, 29, 11, 23, 5, 31, 7, 29, 13, 23, 17, 19, 7, 31, 3, 37, 11, 29, 17, 23, 5, 37, 11, 31
Offset: 4

Views

Author

Seiichi Manyama, Jun 13 2018

Keywords

Examples

			  n  | (p,q)
  ---+----------------------------
   4 | (3,  5);
   5 | (3,  7);
   6 | (5,  7);
   7 | (3, 11);
   8 | (3, 13), (5, 11);
   9 | (5, 13), (7, 11);
  10 | (3, 17), (7, 13);
  11 | (3, 19), (5, 17);
  12 | (5, 19), (7, 17), (11, 13);
		

Crossrefs

Cf. A002373, A020481, A061357 (the size of row n), A078496, A078587.

Programs

  • Mathematica
    row[n_] := Select[Table[{p, 2 n - p}, {p, Prime[Range[PrimePi[n]]]}], Less @@ # && AllTrue[#, PrimeQ]&] // Union;
    Table[row[n], {n, 4, 25}] // Flatten (* Jean-François Alcover, Jun 16 2018 *)
Showing 1-10 of 11 results. Next