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-5 of 5 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

A065577 Number of Goldbach partitions of 10^n.

Original entry on oeis.org

2, 6, 28, 127, 810, 5402, 38807, 291400, 2274205, 18200488, 149091160, 1243722370, 10533150855, 90350630388
Offset: 1

Views

Author

Robert G. Wilson v, Dec 01 2001

Keywords

Comments

Number of ways of writing 10^n as the sum of two odd primes, when the order does not matter.

Examples

			a(1)=2 because 10 = 3+7 = 5+5;
a(2)=6 because 100 = 3+97 = 11+89 = 17+83 = 29+71 = 41+59 = 47+53; ...
		

Crossrefs

Programs

  • Mathematica
    NextPrim[n_] := Block[{k = n + 1}, While[ !PrimeQ[k], k++ ]; k]; f[n_] := Block[{c = 0, lmt = n/2, p = 3}, While[p <= lmt, If[ PrimeQ[n - p], c++ ]; p = NextPrim@p]; c]; Array[f, 10] (* Robert G. Wilson v, Nov 01 2006 *)
    a[n]:=Length[Select[n - Prime[Range[PrimePi[n/2]]], PrimeQ]]; Table[a[n],{n, 10^3, 10^3}] (* Luciano Ancora, Mar 16 2015 *)

Formula

a(n) = A061358(10^n).

Extensions

a(9) from Zak Seidov Nov 01 2006
a(10) from R. J. Mathar and David W. Wilson, Nov 02 2006
a(11) from David W. Wilson and Russ Cox, Nov 03 2006
a(12) from Russ Cox, Nov 04 2006
a(13) from Donovan Johnson, Nov 16 2009
a(14) from Huang Yuanbing (bailuzhou(AT)163.com), Dec 24 2009

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.

A204938 Irregular table T(n,k) of primes such that all terms in row n have a prime companion that sums to 10^n.

Original entry on oeis.org

3, 5, 7, 3, 11, 17, 29, 41, 47, 53, 59, 71, 83, 89, 97, 3, 17, 23, 29, 47, 53, 59, 71, 89, 113, 137, 173, 179, 191, 227, 239, 257, 281, 317, 347, 353, 359, 383, 401, 431, 443, 479, 491, 509, 521, 557, 569, 599, 617, 641, 647, 653, 683, 719, 743, 761, 773
Offset: 1

Views

Author

Livio Rosai, Jan 27 2012

Keywords

Comments

Row 1 has 3 terms. Row 2 has 12 terms. Row 3 has 56 terms. All rows after the first have an even number of terms.

Examples

			3+7=10, 41+59=100, 317+683=1000.
		

Crossrefs

Cf. A107318 (number of terms in row n).
Cf. A126691, A126692, A126693 (primes that sum to 100, 1000, and 10000).

Programs

  • Mathematica
    Flatten[Table[ps = Prime[Range[PrimePi[10^n]]]; Select[ps, MemberQ[ps, 10^n - #] &], {n, 3}]] (* T. D. Noe, Jan 27 2012 *)
Showing 1-5 of 5 results.