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.

A341945 Number of partitions of n into 2 primes (counting 1 as a prime).

Original entry on oeis.org

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

Views

Author

Ilya Gutkovskiy, Feb 24 2021

Keywords

Comments

Number of partitions of n into 2 noncomposite numbers, A008578. - Antti Karttunen, Dec 13 2021

Crossrefs

Programs

  • Maple
    b:= proc(n, i) option remember; series(`if`(n=0, 1,
         `if`(i<0, 0, (p-> `if`(p>n, 0, x*b(n-p, i)))(
         `if`(i=0, 1, ithprime(i)))+b(n, i-1))), x, 3)
        end:
    a:= n-> coeff(b(n, numtheory[pi](n)), x, 2):
    seq(a(n), n=2..90);  # Alois P. Heinz, Feb 24 2021
  • Mathematica
    a[n_] := If[2 == n, 1, Module[{s = 0}, For[p = 2, True, p = NextPrime[p], If[p > n-p, Return[s + Boole[PrimeQ[n-1]]], s += Boole[PrimeQ[n-p]]]]]];
    Table[a[n], {n, 2, 100}] (* Jean-François Alcover, Jan 03 2022, after Antti Karttunen *)
  • PARI
    A341945(n) = if(2==n,1,my(s=0); forprime(p=2,,if(p>(n-p), return(s+isprime(n-1)), s += isprime(n-p)))); \\ Antti Karttunen, Dec 13 2021