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-4 of 4 results.

A000586 Number of partitions of n into distinct primes.

Original entry on oeis.org

1, 0, 1, 1, 0, 2, 0, 2, 1, 1, 2, 1, 2, 2, 2, 2, 3, 2, 4, 3, 4, 4, 4, 5, 5, 5, 6, 5, 6, 7, 6, 9, 7, 9, 9, 9, 11, 11, 11, 13, 12, 14, 15, 15, 17, 16, 18, 19, 20, 21, 23, 22, 25, 26, 27, 30, 29, 32, 32, 35, 37, 39, 40, 42, 44, 45, 50, 50, 53, 55, 57, 61, 64, 67, 70, 71, 76, 78, 83, 87, 89, 93, 96
Offset: 0

Views

Author

Keywords

Examples

			n=16 has a(16) = 3 partitions into distinct prime parts: 16 = 2+3+11 = 3+13 = 5+11.
		

References

  • H. Gupta, Certain averages connected with partitions. Res. Bull. Panjab Univ. no. 124 1957 427-430.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence in two entries, N0004 and N0039).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A000041, A070215, A000607 (parts may repeat), A112022, A000009, A046675, A319264, A319267.

Programs

  • Haskell
    a000586 = p a000040_list where
       p _  0 = 1
       p (k:ks) m = if m < k then 0 else p ks (m - k) + p ks m
    -- Reinhard Zumkeller, Aug 05 2012
    
  • Maple
    b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
          b(n, i-1)+`if`(ithprime(i)>n, 0, b(n-ithprime(i), i-1))))
        end:
    a:= n-> b(n, numtheory[pi](n)):
    seq(a(n), n=0..100);  # Alois P. Heinz, Nov 15 2012
  • Mathematica
    CoefficientList[Series[Product[(1+x^Prime[k]), {k, 24}], {x, 0, Prime[24]}], x]
    b[n_, i_] := b[n, i] = If[n == 0, 1, If[i < 1, 0, b[n, i-1] + If[Prime[i] > n, 0, b[n - Prime[i], i-1]]]]; a[n_] := b[n, PrimePi[n]]; Table[a[n], {n, 0, 100}] (* Jean-François Alcover, Apr 09 2014, after Alois P. Heinz *)
    nmax = 100; pmax = PrimePi[nmax]; poly = ConstantArray[0, nmax + 1]; poly[[1]] = 1; poly[[2]] = 0; poly[[3]] = 1; Do[p = Prime[k]; Do[poly[[j]] += poly[[j - p]], {j, nmax + 1, p + 1, -1}];, {k, 2, pmax}]; poly (* Vaclav Kotesovec, Sep 20 2018 *)
  • PARI
    a(n,k=n)=if(n<1, !n, my(s);forprime(p=2,k,s+=a(n-p,p-1));s) \\ Charles R Greathouse IV, Nov 20 2012
    
  • Python
    from sympy import isprime, primerange
    from functools import cache
    @cache
    def a(n, k=None):
        if k == None: k = n
        if n < 1: return int(n == 0)
        return sum(a(n-p, p-1) for p in primerange(1, k+1))
    print([a(n) for n in range(83)]) # Michael S. Branicky, Sep 03 2021 after Charles R Greathouse IV

Formula

G.f.: Product_{k>=1} (1+x^prime(k)).
a(n) = A184171(n) + A184172(n). - R. J. Mathar, Jan 10 2011
a(n) = Sum_{k=0..A024936(n)} A219180(n,k). - Alois P. Heinz, Nov 13 2012
log(a(n)) ~ Pi*sqrt(2*n/(3*log(n))) [Roth and Szekeres, 1954]. - Vaclav Kotesovec, Sep 13 2018

Extensions

Entry revised by N. J. A. Sloane, Jun 10 2012

A109611 Chen primes: primes p such that p + 2 is either a prime or a semiprime.

Original entry on oeis.org

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 47, 53, 59, 67, 71, 83, 89, 101, 107, 109, 113, 127, 131, 137, 139, 149, 157, 167, 179, 181, 191, 197, 199, 211, 227, 233, 239, 251, 257, 263, 269, 281, 293, 307, 311, 317, 337, 347, 353, 359, 379, 389, 401, 409
Offset: 1

Views

Author

Paul Muljadi, Jul 31 2005

Keywords

Comments

43 is the first prime which is not a member (see A102540).
Contains A001359 = lesser of twin primes.
A063637 is a subsequence. - Reinhard Zumkeller, Mar 22 2010
In 1966 Chen proved that this sequence is infinite; his proof did not appear until 1973 due to the Cultural Revolution. - Charles R Greathouse IV, Jul 12 2016
Primes p such that p + 2 is a term of A037143. - Flávio V. Fernandes, May 08 2021
Named after the Chinese mathematician Chen Jingrun (1933-1996). - Amiram Eldar, Jun 10 2021

Examples

			a(4) = 7 because 7 + 2 = 9 and 9 is a semiprime.
a(5) = 11 because 11 + 2 = 13, a prime.
		

Crossrefs

Programs

  • Maple
    A109611 := proc(n)
        option remember;
        if n =1 then
            2;
        else
            a := nextprime(procname(n-1)) ;
            while true do
                if isprime(a+2) or numtheory[bigomega](a+2) = 2 then
                    return a;
                end if;
                a := nextprime(a) ;
            end do:
        end if;
    end proc: # R. J. Mathar, Apr 26 2013
  • Mathematica
    semiPrimeQ[x_] := TrueQ[Plus @@ Last /@ FactorInteger[ x ] == 2]; Select[Prime[Range[100]], PrimeQ[ # + 2] || semiPrimeQ[ # + 2] &] (* Alonso del Arte, Aug 08 2005 *)
    SequencePosition[PrimeOmega[Range[500]], {1, , 1|2}][[All, 1]] (* _Jean-François Alcover, Feb 10 2018 *)
  • PARI
    isA001358(n)= if( bigomega(n)==2, return(1), return(0) );
    isA109611(n)={ if( ! isprime(n), return(0), if( isprime(n+2), return(1), return( isA001358(n+2)) ); ); }
    { n=1; for(i=1,90000, p=prime(i); if( isA109611(p), print(n," ",p); n++; ); ); } \\ R. J. Mathar, Aug 20 2006
    
  • PARI
    list(lim)=my(v=List([2]),semi=List(),L=lim+2,p=3); forprime(q=3,L\3, forprime(r=3,min(L\q,q), listput(semi,q*r))); semi=Set(semi); forprime(q=7,lim, if(setsearch(semi,q+2), listput(v,q))); forprime(q=5,L, if(q-p==2, listput(v,p)); p=q); Set(v) \\ Charles R Greathouse IV, Aug 25 2017
    
  • Python
    from sympy import isprime, primeomega
    def ok(n): return isprime(n) and (primeomega(n+2) < 3)
    print(list(filter(ok, range(1, 410)))) # Michael S. Branicky, May 08 2021

Formula

a(n)+2 = A139690(n).
Sum_{n>=1} 1/a(n) converges (Zhou, 2009). - Amiram Eldar, Jun 10 2021

Extensions

Corrected by Alonso del Arte, Aug 08 2005

A112020 Number of partitions of n into distinct semiprimes.

Original entry on oeis.org

1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 2, 0, 0, 1, 2, 2, 1, 0, 1, 3, 2, 2, 1, 2, 3, 5, 2, 2, 3, 5, 4, 5, 3, 4, 6, 9, 6, 5, 6, 10, 10, 9, 7, 9, 12, 14, 12, 11, 14, 18, 17, 16, 16, 19, 21, 24, 21, 23, 26, 29, 30, 32, 31, 33, 39, 40, 39, 41, 45, 49, 54, 53, 54, 59, 68, 66, 68, 70, 78, 82, 88, 86, 93, 101
Offset: 0

Views

Author

Reinhard Zumkeller, Aug 26 2005

Keywords

Examples

			For n=4 one partition: {2*2}.
For n=6 one partition: {2*3}.
For n=10 two partitions: {2*2+2*3,2*5}.
		

Crossrefs

Programs

  • Maple
    h:= proc(n) option remember; `if`(n=0, 0,
         `if`(numtheory[bigomega](n)=2, n, h(n-1)))
        end:
    b:= proc(n, i) option remember; `if`(n=0, 1, `if`(i<1, 0,
          b(n-i, h(min(n-i, i-1)))+b(n, h(i-1))))
        end:
    a:= n-> b(n, h(n)):
    seq(a(n), n=0..100);  # Alois P. Heinz, Mar 19 2024
  • Mathematica
    nmax = 100;
    CoefficientList[Series[Product[1+x^(Prime[j] Prime[k]), {j, 1, nmax}, {k, j, nmax}], {x, 0, nmax}], x] (* Jean-François Alcover, Nov 10 2021 *)

A112021 Number of partitions of n into Chen primes.

Original entry on oeis.org

0, 1, 1, 1, 2, 2, 3, 3, 4, 5, 6, 7, 9, 10, 12, 14, 17, 19, 23, 26, 30, 35, 40, 46, 52, 60, 67, 77, 87, 98, 111, 124, 140, 157, 175, 197, 219, 244, 272, 302, 336, 372, 412, 456, 503, 556, 613, 675, 742, 816, 896, 983, 1078, 1180, 1291, 1411, 1542, 1683, 1836, 2001, 2178
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 26 2005

Keywords

Comments

a(n) = A000607(n) for n <= 42.

Crossrefs

Programs

  • Mathematica
    fQ[n_] := PrimeQ@n && (PrimeQ[n + 2] || 2 == Plus @@ Last /@ FactorInteger[n + 2]); f[n_] := Block[{c = k = 0, l = PartitionsP@n, p = Union /@ IntegerPartitions@n}, While[k++; k < l, If[Union[fQ /@ p[[k]]] == {True}, c++ ]]; c]; lst = {}; Do[ AppendTo[lst, f[n]], {n, 61}]; lst (* or *)
    Rest@ CoefficientList[ Series[1/Times @@ (1 - x^Select[ Range@100, fQ@# &]), {x, 0, 61}], x] (* Robert G. Wilson v, Jun 16 2006 *)
  • PARI
    ok(n)={isprime(n) && bigomega(n+2)<3}
    {my(n=80); Vec(prod(k=1, n, if(ok(k), 1/(1-x^k) + O(x*x^n), 1))-1,-n)} \\ Andrew Howroyd, Dec 28 2017

Formula

G.f.: Product_{k>=1} 1/(1 - x^A109611(k)). - Andrew Howroyd, Dec 28 2017
Showing 1-4 of 4 results.