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.

A339434 Number of compositions (ordered partitions) of n into a prime number of distinct prime parts.

This page as a plain text file.
%I A339434 #13 Mar 01 2022 05:32:10
%S A339434 0,0,0,0,0,2,0,2,2,2,8,0,8,2,8,8,10,0,16,8,16,14,16,12,18,14,22,18,
%T A339434 136,18,138,26,22,26,258,30,266,30,266,158,492,36,506,158,510,278,744,
%U A339434 174,748,290,758,528,990,306,1228,668,1116,780,6384,678,6630,800,1720,1274
%N A339434 Number of compositions (ordered partitions) of n into a prime number of distinct prime parts.
%H A339434 Alois P. Heinz, <a href="/A339434/b339434.txt">Table of n, a(n) for n = 0..10000</a>
%H A339434 <a href="/index/Com#comp">Index entries for sequences related to compositions</a>
%e A339434 a(10) = 8 because we have [7, 3], [3, 7], [5, 3, 2], [5, 2, 3], [3, 5, 2], [3, 2, 5], [2, 5, 3] and [2, 3, 5].
%p A339434 s:= proc(n) option remember; `if`(n<1, 0, ithprime(n)+s(n-1)) end:
%p A339434 b:= proc(n, i, t) option remember; `if`(s(i)<n, 0,
%p A339434       `if`(n=0, `if`(isprime(t), t!, 0), (p->`if`(p>n, 0,
%p A339434          b(n-p, i-1, t+1)))(ithprime(i))+b(n, i-1, t)))
%p A339434     end:
%p A339434 a:= n-> b(n, numtheory[pi](n), 0):
%p A339434 seq(a(n), n=0..70);  # _Alois P. Heinz_, Dec 04 2020
%t A339434 s[n_] := s[n] = If[n < 1, 0, Prime[n] + s[n - 1]];
%t A339434 b[n_, i_, t_] := b[n, i, t] = If[s[i] < n, 0,
%t A339434      If[n == 0, If[PrimeQ[t], t!, 0], Function[p, If[p > n, 0,
%t A339434        b[n - p, i - 1, t + 1]]][Prime[i]] + b[n, i - 1, t]]];
%t A339434 a[n_] := b[n, PrimePi[n], 0];
%t A339434 Table[a[n], {n, 0, 70}] (* _Jean-François Alcover_, Mar 01 2022, after _Alois P. Heinz_ *)
%Y A339434 Cf. A000040, A045450, A052467, A085755, A085756, A102623, A219107.
%K A339434 nonn,look
%O A339434 0,6
%A A339434 _Ilya Gutkovskiy_, Dec 04 2020