OFFSET
1,4
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..2000 (first 781 terms from Reinhard Zumkeller)
EXAMPLE
For n=4, the fourth prime is 7, and we see the three partitions 7=2+5=2+2+3=3+4, so a(4)=3.
MAPLE
b:= proc(n, i) option remember; `if`(n=0 or i=2, 1-irem(n, 2),
`if`(i<2, 0, b(n, i-1)+b(n-i, min(i, n-i))))
end:
a:= n-> (p-> b(p, p-1))(ithprime(n)):
seq(a(n), n=1..45); # Alois P. Heinz, Mar 11 2018
MATHEMATICA
b[n_, i_] := b[n, i] = If[n == 0 || i == 2, 1 - Mod[n, 2], If[i < 2, 0, b[n, i - 1] + b[n - i, Min[i, n - i]]]];
a[n_] := b[#, # - 1]&[Prime[n]];
Table[a[n], {n, 1, 45}] (* Jean-François Alcover, May 20 2018, after Alois P. Heinz *)
PROG
(Haskell)
import Data.MemoCombinators (memo2, integral)
a260798 n = a260798_list !! (n-1)
a260798_list = map (subtract 1 . pMemo 2) a000040_list where
pMemo = memo2 integral integral p
p _ 0 = 1
p k m | m < k = 0
| otherwise = pMemo k (m - k) + pMemo (k + 1) m
-- Reinhard Zumkeller, Aug 09 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Marc LeBrun and N. J. A. Sloane, Aug 07 2015
STATUS
approved