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 10 results.

A061358 Number of ways of writing n = p+q with p, q primes and p >= q.

Original entry on oeis.org

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

Views

Author

Amarnath Murthy, Apr 28 2001

Keywords

Comments

For an odd number n, a(n) = 0 if n-2 is not a prime, otherwise a(n) = 1.
For n > 1, a(2n) is at least 1, according to Goldbach's conjecture.
a(A014092(n)) = 0; a(A014091(n)) > 0; a(A067187(n)) = 1. - Reinhard Zumkeller, Nov 22 2004
Number of partitions of n into two primes.
Number of unordered ways of writing n as the sum of two primes.
a(2*n) = A068307(2*n+2). - Reinhard Zumkeller, Aug 08 2009
4*a(n) is the total number of divisors of all primes p and q such that n = p+q and p >= q. - Wesley Ivan Hurt, Mar 05 2016
Indices where a(n) = 0 correspond to A164376 UNION A025584. - Bill McEachen, Jan 31 2024

Examples

			a(22) = 3 because 22 can be written as 3+19, 5+17 and 11+11.
		

Crossrefs

Programs

  • Magma
    [#RestrictedPartitions(n,2,{p:p in PrimesUpTo(1000)}):n in [0..100] ] // Marius A. Burtea, Jan 19 2019
  • Maple
    g:=sum(sum(x^(ithprime(i)+ithprime(j)),i=1..j),j=1..30): gser:=series(g,x=0,110): seq(coeff(gser,x,n),n=0..105); # Emeric Deutsch, Apr 03 2006
  • Mathematica
    a[n_] := Length[Select[n - Prime[Range[PrimePi[n/2]]], PrimeQ]]; Table[a[n], {n, 0, 100}] (* Paul Abbott, Jan 11 2005 *)
    With[{nn=110},CoefficientList[Series[Sum[x^(Prime[i]+Prime[j]),{j,nn},{i,j}],{x,0,nn}],x]] (* Harvey P. Dale, Aug 17 2017 *)
    Table[Count[IntegerPartitions[n,{2}],?(AllTrue[#,PrimeQ]&)],{n,0,110}] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale, Jul 03 2021 *)
  • PARI
    a(n)=my(s);forprime(q=2,n\2,s+=isprime(n-q));s \\ Charles R Greathouse IV, Mar 21 2013
    
  • Python
    from sympy import primerange, isprime, floor
    def a(n):
        s=0
        for q in primerange(2, n//2 + 1): s+=isprime(n - q)
        return s
    print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 30 2017
    

Formula

G.f.: Sum_{j>0} Sum_{i=1..j} x^(p(i)+p(j)), where p(k) is the k-th prime. - Emeric Deutsch, Apr 03 2006
A065577(n) = a(10^n).
From Wesley Ivan Hurt, Jan 04 2013: (Start)
a(n) = Sum_{i=1..floor(n/2)} A010051(i) * A010051(n-i).
a(n) = Sum_{i=1..floor(n/2)} floor((A010051(i) + A010051(n-i))/2). (End)
a(n) + A062610(n) + A062602(n) = A004526(n). - R. J. Mathar, Sep 10 2021
a(n) = Sum_{k=floor((n-1)^2/4)+1..floor(n^2/4)} c(A339399(2k-1)) * c(A339399(2k)), where c = A010051. - Wesley Ivan Hurt, Jan 19 2022

Extensions

More terms from Larry Reeves (larryr(AT)acm.org), May 15 2001
Comments edited by Zak Seidov, May 28 2014

A073610 Number of primes of the form n-p where p is a prime.

Original entry on oeis.org

0, 0, 0, 1, 2, 1, 2, 2, 2, 3, 0, 2, 2, 3, 2, 4, 0, 4, 2, 4, 2, 5, 0, 6, 2, 5, 0, 4, 0, 6, 2, 4, 2, 7, 0, 8, 0, 3, 2, 6, 0, 8, 2, 6, 2, 7, 0, 10, 2, 8, 0, 6, 0, 10, 2, 6, 0, 7, 0, 12, 2, 5, 2, 10, 0, 12, 0, 4, 2, 10, 0, 12, 2, 9, 2, 10, 0, 14, 0, 8, 2, 9, 0, 16, 2, 9, 0, 8, 0, 18, 2, 8, 0, 9, 0, 14, 0, 6
Offset: 1

Views

Author

Amarnath Murthy, Aug 05 2002

Keywords

Comments

a(p) = 2 if p-2 is a prime else a(p) = 0. If n = 2p, p is a prime then a(n) is odd else a(n) is even. As p is counted only once and if q and n-q both are prime then the count is increased by 2. ( Analogous to the fact that perfect squares have odd number of divisors).
a(2k+1) = 2 if (2k-1) is prime, else a(2k+1)=0 (for any k). This sequence can be used to re-describe a couple of conjectures: the Goldbach conjecture == a(2n) > 0 for all n>=2; twin primes conjecture == for any n, there is a prime p>n s.t. a(p)>0.
Number of ordered ways of writing n as the sum of two primes.

Examples

			a(16) = 4 as there are 4 primes 3,5,11 and 13 such that 16-3,16-5,16-11and 16-13 are primes.
		

Crossrefs

Programs

  • Maple
    for i from 1 to 500 do a[i] := 0:j := 1:while(ithprime(j)
    				
  • Mathematica
    nn=20;a[x]:=Sum[x^i,{i,Table[Prime[n],{n,1,nn}]}];Drop[CoefficientList[a[x]^2,x],1]  (* Geoffrey Critzer, Nov 22 2012 *)
  • PARI
    Vec(sum(i=1,100,x^prime(i),O(x^prime(101)))^2) \\ Charles R Greathouse IV, Jan 21 2015

Formula

G.f.: (Sum_{k>0} x^prime(k))^2. - Vladeta Jovovic, Mar 12 2005
Self-convolution of characteristic function of primes (A010051). - Graeme McRae, Jul 18 2006

Extensions

Corrected and extended by Vladeta Jovovic and Sascha Kurz, Aug 06 2002

A107318 Number of ordered Goldbach partitions of 10^n.

Original entry on oeis.org

3, 12, 56, 254, 1620, 10804, 77614, 582800, 4548410, 36400976, 298182320, 2487444740, 21066301710
Offset: 1

Views

Author

N. J. A. Sloane, based on email from R. J. Mathar, Nov 07 2006

Keywords

Comments

Number of ways of writing 10^n as the sum of two odd primes, when the order matters.
Apart from a(1), equals 2*A065577(n).

Crossrefs

See A065577 for further information.

Extensions

a(13) from Donovan Johnson, Nov 16 2009

A124450 Lesser of a pair of not necessarily distinct closest primes that add up to 10^n.

Original entry on oeis.org

5, 47, 491, 4919, 49877, 499943, 4999913, 49999757, 499999931, 4999999937, 49999999811, 499999999769, 4999999998431, 49999999999619, 499999999999769, 4999999999998557, 49999999999998887, 499999999999999679, 4999999999999999661, 49999999999999998647
Offset: 1

Views

Author

Zak Seidov, Nov 02 2006

Keywords

Comments

a(n) is always an n digit number.
Note that if distinct primes are required, the only change is that a(1) = 3.

Examples

			10^1=5+5; 10^2=47+53; 10^3=491+509;
10^4=4919+5081; 10^5=49877=50123; 10^6=499943+500057;
10^7=4999913+5000087; 10^8=49999757+50000243;
10^9=499999931+500000069;
10^10=4999999937+5000000063; etc.
		

Crossrefs

Cf. A065577 (number of Goldbach partitions of 10^n).
Cf. A124013.

Programs

  • Mathematica
    Table[ h =10^n/2; c=0; While[ PrimeQ[ h-c ]==False || PrimeQ[ h+c ]==False, c++ ]; h-c, {n, 1, 50} ] (* Hans Havermann, Nov 02 2006 *)

Formula

10^n - a(n) is prime.

Extensions

Edited by N. J. A. Sloane May 15 2008 at the suggestion of R. J. Mathar.

A180007 Number of Goldbach partitions of 6^n.

Original entry on oeis.org

1, 4, 13, 49, 161, 656, 2751, 12505, 58482, 280348, 1374563, 6864809
Offset: 1

Views

Author

Jonathan Vos Post, Aug 06 2010

Keywords

Comments

Number of ways of writing 6^n as the sum of two odd primes, when the order does not matter. Number of ways writing 6^n as unordered sums of 2 primes. This is to 6 as A006307 is to 2 and as A065577 is to 10. This is the 6th row of the array A[k,n] = Number of ways writing k^n as unordered sums of 2 primes.
A061358(4^n) starts 1, 2, 5, 8, 22, 53, 151, 435, for n=1,2,... (bisection of A006307). A061358(8^n) starts 1, 5, 11, 53, 244, 1314, 7471, (tri-section of A006307). A061358(10^n) = A065577(n). A061358(12^n) = 1, 11, 53, 348, 2523, 20564... A061358(14^n) = 2, 9, 50, 330, 2924, 27225,... - R. J. Mathar, Aug 07 2010

Examples

			a(1) = 1 because 6^1 = 6 = 3+3.
a(2) = 4 because 6^2 = 36 = 5+31 = 7+29 = 13+23 = 17+19.
a(3) = 13 because 6^3 = 216 = 5+211 = 17+199 = 19+197 = 23+193 = 37+179 = 43+173 = 53+163 = 59+157 = 67+149 = 79+137 = 89+127 = 103+113 = 107+109.
		

Crossrefs

Programs

  • Maple
    A061358 := proc(n) local a,p ; a := 0 ; p := nextprime(floor((n-1)/2)) ; while p <= n do if isprime(n-p) then a := a+1 ; end if; p := nextprime(p) ; end do ; return a; end proc:
    A180007 := proc(n) A061358(6^n) ; end proc:
    for n from 1 do printf("%d,\n",A180007(n)) ; end do:
    # R. J. Mathar, Aug 07 2010
  • Mathematica
    Table[Count[Sort@ IntegerPartitions[6^n, {2}], {u_, v_} /; And[PrimeQ@ u, u != 2, PrimeQ@ v]], {n, 6}] (* Michael De Vlieger, Jun 02 2015 *)
  • PARI
    a(n)=my(t=6^n,s); forprime(p=2,t\2, if(isprime(t-p), s++)); s \\ Charles R Greathouse IV, Jun 02 2015

Formula

a(n) = A061358(6^n) = A061358(A000400(n)).

Extensions

a(5) corrected, 4 terms added by R. J. Mathar, Aug 07 2010
a(10)-a(12) from Manfred Scheucher, Jun 01 2015

A124013 Lesser of pair of most widely separated primes whose sum is 10^n.

Original entry on oeis.org

3, 3, 3, 59, 11, 17, 29, 11, 71, 71, 23, 11, 29, 29, 11, 83, 3, 11, 281, 11, 101, 71, 23, 257, 401, 293, 107, 293, 53, 11, 113, 251, 47, 587, 23, 179, 389, 59, 173, 17, 1427, 83, 431, 53, 563, 593, 41, 47, 239, 383, 431, 1181, 701, 971, 149, 593, 569, 149, 191, 1973
Offset: 1

Views

Author

Zak Seidov, Nov 02 2006

Keywords

Examples

			10^1 = 3 + 7, 10^2 = 3 + 97, 10^3 = 3 + 997, 10^4 = 59 + 9941, 10^5 = 11 + 99989, 10^6 = 17 + 999983, 10^7 = 29 + 9999971, 10^8 = 11 + 99999989, 10^9 = 71 + 999999929, 10^10 = 71 + 9999999929, etc.
		

Crossrefs

Cf. A065577 (Number of Goldbach partitions of 10^n), A124450 (Lesser of pair of closest primes summed to 10^n).

Programs

  • Mathematica
    Table[DeleteCases[Map[{#, 10^n - #} &, Prime@ Range@ PrimePi@ Floor[10^n/2]] /. {, k} /; ! PrimeQ@ k -> 0, 0][[1, 1]], {n, 8}] (* or *)
    Table[First@ SelectFirst[Map[{#, 10^n - #} &, Prime@ Range@ PrimePi@ Floor[10^n/2]], PrimeQ@ Last@ # &], {n, 9}] (* Version 10, Michael De Vlieger, Aug 01 2016 *)
    lp[n_]:=Module[{p=3,x=10^n},While[CompositeQ[x-p],p=NextPrime[p]];p]; Array[lp,60] (* Harvey P. Dale, Jun 11 2022 *)

Formula

10^n - a(n) is prime and 10^n - k is composite for 0 <= k < a(n). - corrected by David A. Corneth, Aug 18 2016

Extensions

a(1) corrected and a(2) inserted by Gionata Neri, Aug 01 2016

A124049 a(n) = c is least number such that 10^n/2 -/+ c are primes.

Original entry on oeis.org

0, 3, 9, 81, 123, 57, 87, 243, 69, 63, 189, 231, 1569, 381, 231, 1443, 1113, 321, 339, 1353, 363, 519, 1323, 1503, 741, 1221, 957, 1053, 339, 5931, 2121, 2301, 2031, 4773, 4737, 10281, 1317, 129, 3873, 1443, 387, 11769, 8271, 5337, 2883, 7137, 8193, 8493
Offset: 1

Views

Author

Hans Havermann and Zak Seidov, Nov 03 2006

Keywords

Comments

Related to Goldbach pairs of 10^n: a(n)=10^n/2 -A124450(n) Lesser of pair of closest primes whose sum is 10^n. Cf. A124013 Lesser of pair of most widely separated primes whose sum is 10^n, A065577 Number of Goldbach partitions of 10^n
All terms are divisible by 3 - see A108163.

Examples

			Next terms up to n = 101: 14637, 9897,
6471, 183, 8043, 6921,6699, 29127, 3663, 12537, 3777,
6741, 2253, 561, 3783, 26979, 16491, 6543, 10683,
1749, 6417, 38871, 22767, 62403, 8631, 4497, 20739,
453, 16731, 25293, 4341, 37467,
55323,4587,37083,24717,6687,8763,22551,29367,37881,14301,8637,34101,22179,26811,7059,1647
		

Crossrefs

Programs

  • Mathematica
    lnc[n_]:=Module[{c=0,t=10^n/2},While[!AllTrue[t+{c,-c},PrimeQ],c++];c]; Array[ lnc,50] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Dec 21 2014 *)

A359120 Number of primes p with 10^(n-1) < p < 10^n such that 10^n-p is also prime.

Original entry on oeis.org

3, 11, 47, 221, 1433, 9579, 69044, 519260, 4056919, 32504975, 266490184, 2224590493, 18850792161
Offset: 1

Views

Author

N. J. A. Sloane, Dec 17 2022

Keywords

Comments

The terms of A358310 come in decreasing blocks; a(n) is the length of the n-th block.

Examples

			For n = 1, there are three primes p with 1 < p < 10 such that 10-p is also prime, 3, 5, and 7, so a(1) = 3.
		

Crossrefs

A107318 and A065577 are very similar.

Programs

  • PARI
    a(n) = {if(n==1,return(3)); my(res=0, pow10=10^n); forprime(p=2, 10^(n-1), if(isprime(pow10-p), res++)); forprime(p=10^(n-1), pow10>>1, if(isprime(pow10-p), res+=2)); res} \\ David A. Corneth, Dec 17 2022
    
  • Python
    from sympy import isprime, primerange
    def a(n):
        lb, ub = 10**(n-1), 10**n
        s1 = sum(1 for p in primerange(1, lb) if isprime(ub-p))
        s2 = sum(2 for p in primerange(lb, 5*lb) if isprime(ub-p))
        return s1 + s2 + int(n == 1)
    print([a(n) for n in range(1, 8)]) # Michael S. Branicky, Dec 17 2022

Extensions

a(7)-a(9) from Michael S. Branicky, Dec 17 2022
a(10)-a(11) from David A. Corneth, Dec 17 2022
a(12) from N. J. A. Sloane, Dec 17 2022, found using Corneth's PARI program.
a(13) from Martin Ehrenstein, Dec 18 2022, found using Walisch's primesieve library.

A180041 Number of Goldbach partitions of (2n)^n.

Original entry on oeis.org

0, 2, 13, 53, 810, 20564, 274904, 6341424, 419586990
Offset: 1

Views

Author

Jonathan Vos Post, Aug 07 2010

Keywords

Comments

This is the main diagonal of the array mentioned in A180007, only considering even rows (as odd numbers cannot be the sums of two odd primes), namely A(2n, n) = number of ways of writing (2n)^n as the sum of two odd primes, when the order does not matter.

Examples

			a(1) = 0 because 2*1 = 2 is too small to be the sum of two primes.
a(2) = 2 because 4^2 = 16 = 3+13 = 5+11.
a(3) = 13 because 6^3 = 216 and A180007(3) = Number of Goldbach partitions of 6^3 = 13.
a(4) = 53 because 8^4 = 2^12 and A006307(12) = Number of ways writing 2^12 as unordered sums of 2 primes.
		

Crossrefs

Programs

  • Maple
    A180041 := proc(n) local a,m,p: if(n=1)then return 0:fi: a:=0: m:=(2*n)^n: p:=prevprime(ceil((m-1)/2)): while p > 2 do if isprime(m-p) then a:=a+1: fi: p := prevprime(p): od: return a: end: seq(A180041(n),n=1..5); # Nathaniel Johnston, May 08 2011
  • Mathematica
    f[n_] := Block[{c = 0, p = 3, m = (2 n)^n}, lmt = Floor[m/2] + 1; While[p < lmt, If[ PrimeQ[m - p], c++ ]; p = NextPrime@p]; c]; Do[ Print[{n, f@n // Timing}], {n, 8}] (* Robert G. Wilson v, Aug 10 2010 *)

Formula

a(n) = A061358((2*n)^n) = A061358(A062971(n)).

Extensions

a(6)-a(8) from Robert G. Wilson v, Aug 10 2010
a(9) from Giovanni Resta, Apr 15 2019

A195295 Number of Goldbach partitions of 4^n.

Original entry on oeis.org

0, 1, 2, 5, 8, 22, 53, 151, 435, 1314, 4239, 13705, 45746, 153850, 525236, 1817111, 6341424, 22336060, 79287664, 283277225, 1018369893
Offset: 0

Views

Author

Kausthub Gudipati, Sep 16 2011

Keywords

Comments

Bisection of A006307.

Crossrefs

Showing 1-10 of 10 results.