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

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

A062610 Number of ways of writing n = c1 + c2 with c1 and c2 nonprimes [=1 or composite].

Original entry on oeis.org

0, 1, 0, 0, 1, 0, 1, 1, 1, 2, 1, 2, 2, 2, 2, 4, 2, 4, 3, 4, 3, 5, 3, 6, 4, 6, 4, 7, 5, 8, 6, 7, 6, 9, 6, 11, 7, 8, 8, 11, 8, 12, 9, 11, 9, 12, 9, 14, 10, 14, 10, 14, 11, 16, 12, 15, 12, 16, 13, 19, 14, 15, 14, 19, 14, 21, 15, 17, 16, 21, 16, 22, 17, 20, 17, 22, 17, 25, 18, 22, 19, 23, 19
Offset: 1

Views

Author

Labos Elemer, Jul 04 2001

Keywords

Examples

			n = 22 has floor(n/2) = 11 partitions of form n = a+b; 3 partitions are of prime+prime [3+19 = 5+17 = 11+11], 3 partitions are of prime+nonprime [2+20 = 7+15 = 13+9], 5 partitions are of nonprime+nonprime [1+21 = 4+18 = 6+16 = 8+14 = 10+12]. So a(22) = 5.
		

Crossrefs

Programs

  • Mathematica
    Table[Count[Transpose@ {#, n - #} &@ Range[Floor[n/2]], w_ /; Times @@ Boole@ Map[! PrimeQ@ # &, w] == 1], {n, 83}] (* Michael De Vlieger, Jul 04 2016 *)

Formula

a(n) = Sum_{i=1..floor(n/2)} (1 - A010051(i)) * (1 - A010051(n-i)) = Sum_{i=1..floor(n/2)} A005171(i)*A005171(n-i). - Wesley Ivan Hurt, Apr 08 2018
a(n) + A061358(n) + A062602(n) = A004526(n). - R. J. Mathar, Sep 10 2021

A006307 Number of ways writing 2^n as unordered sums of 2 primes.

Original entry on oeis.org

0, 0, 1, 1, 2, 2, 5, 3, 8, 11, 22, 25, 53, 76, 151, 244, 435, 749, 1314, 2367, 4239, 7471, 13705, 24928, 45746, 83467, 153850, 283746, 525236, 975685, 1817111, 3390038, 6341424, 11891654, 22336060, 42034097, 79287664, 149711134, 283277225, 536710100, 1018369893
Offset: 0

Views

Author

Keywords

Examples

			n = 5: 2^5 = 32 = 3+29 = 13+19 so a(5) = 2.
		

References

  • Bohman, Jan and Froberg, Carl-Erik; Numerical results on the Goldbach conjecture. Nordisk Tidskr. Informationsbehandling (BIT) 15 (1975), no. 3, 239-243.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Maple
    a:=proc(n) local c,k; c:=0: for k from 1 to floor((n-1)/2) do if isprime(2*k+1)=true and isprime(2*n-2*k-1)=true then c:=c+1 else c:=c fi od end: 0,0,1,seq(a(2*2^n),n=1..15); # Emeric Deutsch, Sep 22 2004
  • PARI
    a(n)=my(N=2^n,s); forprime(q=2, N\2, s+=isprime(N-q)); s \\ Charles R Greathouse IV, Mar 02 2015

Formula

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

Extensions

More terms from David W. Wilson
a(28)-a(35) from Ray Chandler, Feb 21 2004
a(36)=79287664 and a(37)=149711134 from Ray Chandler, Apr 10 2005
a(38)-a(40) from Russ Cox, Nov 04 2006

A175933 Number of ways of writing n=p+k with p a prime number and k a primorial number.

Original entry on oeis.org

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

Views

Author

Juri-Stepan Gerasimov, Oct 24 2010

Keywords

Comments

Number of partitions of n into the sum of a prime number and a primorial number. Number of decompositions of n into an unordered sum of a prime number and a primorial number.
For n through small powers of 10, the range of partition values seen is about log_10(n)+2. - Bill McEachen, Jan 07 2016

Examples

			a(4)=2 because 4(natural) = 2(prime)+2(primorial) = 3(prime)+1(primorial).
		

Crossrefs

Programs

  • Maple
    A002110 := proc(n) option remember; if n = 0 then 1; else mul( ithprime(k),k=1..n) ; end if; end proc:
    A175933 := proc(n) a := 0 ; for k from 0 do p := A002110(k) ; if p +2 > n then return a; elif isprime(n-p) then a := a+1 ; end if; end do: end proc:
    seq(A175933(n),n=1..120) ; # R. J. Mathar, Oct 25 2010
  • Mathematica
    t = Table[Product[Prime@ k, {k, n}], {n, 0, 5}]; Table[Count[Map[First, Function[k, Transpose@ {k - #, #} &@ Prime@ Range@ PrimePi@ k]@ n], x_ /; MemberQ[t, x]], {n, 120}]  (* Michael De Vlieger, Jan 09 2016 *)
  • PARI
    lyst(maxx)={n=1; while (n<=maxx,c=0; q=1; for(i5=0, n, if(i5>0, q=q*prime(i5)); if(q>n-2,break); z=truncate(q); if(isprime(n-z),c++)); print1(c,","); n+=1);} \\ Bill McEachen, Jan 07 2016
    
  • PARI
    A175933(n,p=1,k=1,c=0)={until(2>n-k*=p=nextprime(p+1),isprime(n-k)&&c++);c} \\ M. F. Hasler, Jan 21 2016

Extensions

a(85), a(89), etc. corrected by R. J. Mathar, Oct 25 2010

A175940 Number of ways of writing n=p+f with p a prime and f a factorial.

Original entry on oeis.org

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

Views

Author

Juri-Stepan Gerasimov, Oct 25 2010

Keywords

Comments

Number of partitions of n into the sum of a prime number and a factorial number. Number of decompositions of n into an unordered sum of a prime number and a factorial number.

Examples

			a(29)=2 because 29 has two prime + factorial representations, 5+4! and 23+3!.
		

Crossrefs

Programs

  • Maple
    a:= proc(n) local t,k;
           t:= 0;
           for k while k! < n do
             if isprime(n-k!) then t:= t+1 fi
           od;
           t
    end proc:
    seq(a(n), n=1..100); # Robert Israel, Oct 13 2014
  • Mathematica
    a[n_] := Module[{t = 0, k}, For[k = 1, k! < n, k++, If[PrimeQ[n - k!] , t++]]; t];
    Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Feb 02 2023, after Robert Israel *)
  • PARI
    a(n) = c=0;for(i=1,n,if(isprime(n-i!),c++));c
    vector(100,n,a(n)) \\ Derek Orr, Oct 13 2014

Extensions

Edited and entries checked by D. S. McNeil, Nov 26 2010

A224712 The number of unordered partitions {a, b} of n such that a or b is composite and the other is prime.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 1, 1, 2, 1, 4, 2, 3, 2, 4, 2, 6, 2, 5, 3, 6, 3, 8, 2, 7, 4, 9, 5, 9, 3, 8, 6, 9, 4, 11, 3, 11, 8, 10, 6, 12, 4, 11, 7, 12, 7, 14, 4, 13, 7, 15, 9, 15, 5, 14, 10, 16, 9, 16, 4, 15, 12, 16, 8, 18, 6, 18, 14, 17, 9, 19, 7, 18, 11, 19, 11, 21
Offset: 1

Views

Author

J. Stauduhar, Apr 20 2013

Keywords

Examples

			For n = 6, in the set {{5, 1}, {4, 2}, {3, 3}}, {4, 2} is the only partition that satisfies the requirements, so a(6) = 1.
For n = 9, we have partitions {6, 3} and {5, 4}, so a(9) = 2.
		

Crossrefs

Cf. A062602 (allows 1 as well as composites), A224708 (a and b are both composite).

Programs

A062302 Number of ways writing n-th prime as a sum of a prime and a nonprime.

Original entry on oeis.org

0, 1, 0, 1, 4, 3, 6, 5, 8, 9, 8, 11, 12, 11, 14, 15, 16, 15, 18, 19, 18, 21, 22, 23, 24, 25, 24, 27, 26, 29, 30, 31, 32, 31, 34, 33, 36, 37, 38, 39, 40, 39, 42, 41, 44, 43, 46, 47, 48, 47, 50, 51, 50, 53, 54, 55, 56, 55, 58, 59, 58, 61, 62, 63, 62, 65, 66, 67, 68, 67, 70, 71, 72
Offset: 1

Views

Author

Labos Elemer, Jul 05 2001

Keywords

Crossrefs

Programs

  • Mathematica
    Table[c = 0; Do[i = Prime[k]; If[i + j == Prime[n] && ! PrimeQ[j], c = c + 1], {k, n - 1}, {j, Prime[n] - 1}]; c, {n, 73}] (* Jayanta Basu, Apr 22 2013 *)
    nn = 100; mx = Prime[nn]; ps = Prime[Range[nn]]; notPs = Complement[Range[mx], ps]; t2 = Table[0, {Range[mx]}]; Do[s = i + j; If[s <= mx, t2[[s]]++], {i, ps}, {j, notPs}];  t2[[ps]] (* T. D. Noe, Apr 23 2013 *)

Formula

a(n) = A062602(A000040(n)) = number of [nonprime+prime] partitions of prime(n)

A062305 Number of ways writing 2^n as a sum of a prime and a nonprime.

Original entry on oeis.org

0, 0, 1, 2, 2, 7, 8, 25, 38, 75, 128, 259, 458, 876, 1598, 3024, 5672, 10753, 20372, 38656, 73547, 140669, 268537, 514307, 986379, 1896755, 3650109, 7036061, 13580371, 26241380, 50765806, 98317489, 190597373, 369832498, 718266991, 1396138085, 2715823187, 5287080080
Offset: 0

Views

Author

Labos Elemer, Jul 05 2001

Keywords

Examples

			For n = 5: 2^5 = 32 = 31+1 = 2+30 = 5+27 = 7+25 = 11+21 = 17+15 = 23+9 so a(5) = 7.
		

Crossrefs

Programs

  • PARI
    a(n) = {my(c = 0, m = 1 << n); forprime(p = 2, m-1, if(!isprime(m - p), c++)); c;} \\ Amiram Eldar, Jul 17 2024

Formula

a(n) = A062602(2^n) = number of prime+nonprime partitions of 2^n.
a(n) = 2^(n-1) - A006307(n) - A062306(n) for n >= 1. - Amiram Eldar, Jul 17 2024

Extensions

More terms from Dean Hickerson, Jul 23 2001
a(28)-a(32) from Sean A. Irvine, Mar 25 2023
a(33)-a(37) from Amiram Eldar, Jul 17 2024

A062306 Number of ways writing 2^n as a sum of two nonprime numbers.

Original entry on oeis.org

1, 0, 1, 4, 7, 19, 36, 82, 170, 362, 740, 1537, 3144, 6443, 13116, 26661, 54034, 109386, 221121, 446502, 900436, 1814910, 3655069, 7356483, 14796994, 29750473, 59789057, 120112121, 241218391, 484287995, 972034297, 1950544851, 3913243144, 7849331541, 15741697002
Offset: 1

Views

Author

Labos Elemer, Jul 05 2001

Keywords

Examples

			For n = 5: 2^5 = 32 = 4+28 = 6+26 = 8+24 = 10+22 = 12+20 = 14+18 = 16+16, so a(5) = 7.
		

Crossrefs

Formula

a(n) = A062610(2^n) = number of nonprime+nonprime partitions of 2^n.
a(n) = 2^(n-1) - A006307(n) - A062305(n). - Amiram Eldar, Jul 17 2024

Extensions

More terms from Dean Hickerson, Jul 23 2001
a(28)-a(32) from Sean A. Irvine, Mar 25 2023
a(33)-a(35) from Amiram Eldar, Jul 17 2024

A062303 Number of ways writing the n-th prime as a sum of two nonprimes.

Original entry on oeis.org

1, 0, 1, 1, 1, 2, 2, 3, 3, 5, 6, 7, 8, 9, 9, 11, 13, 14, 15, 16, 17, 18, 19, 21, 24, 25, 26, 26, 27, 27, 33, 34, 36, 37, 40, 41, 42, 44, 45, 47, 49, 50, 53, 54, 54, 55, 59, 64, 65, 66, 66, 68, 69, 72, 74, 76, 78, 79, 80, 81, 82, 85, 91, 92, 93, 93, 99, 101, 105, 106, 106, 108
Offset: 1

Views

Author

Labos Elemer, Jul 05 2001

Keywords

Examples

			n=10,p(10)=29 has 14 partitions of form a+b=29; 1+28=4+25=8+21=9+20=14+15 are the 5 relevant partitions, so a(10)=5.
		

Crossrefs

Programs

  • Mathematica
    Table[c = 0; Do[If[i + j == Prime[n] && ! PrimeQ[i] && ! PrimeQ[j], c = c + 1], {i, Prime[n] - 1}, {j, i}]; c, {n, 72}] (* Jayanta Basu, Apr 22 2013 *)
    cnpQ[{a_,b_}]:=(!PrimeQ[a]&&CompositeQ[b])||(!PrimeQ[b]&&CompositeQ[a]); Join[{1},Table[Length[Select[IntegerPartitions[Prime[n],{2}],cnpQ]],{n,2,80}]] (* Harvey P. Dale, Sep 30 2018 *)

Formula

A062610(A000040(n)) = number of [nonprime+composite] partitions of p(n).

Extensions

Offset and name corrected by Sean A. Irvine, Mar 25 2023
Showing 1-10 of 13 results. Next