login
Number of partitions of p=prime(n) into aliquant parts (i.e., parts that do not divide p, meaning any part except 1 and p).
4

%I #25 May 20 2018 11:35:24

%S 0,0,1,3,13,23,65,104,252,846,1237,3659,7244,10086,19195,48341,116599,

%T 155037,356168,609236,792905,1716485,2832213,5887815,15116625,

%U 23911833,29983570,46873052,58443395,90374471,394641602,593224103,1082063335,1318608063,3477935702,4207389268,7398721009,12885091292,18555597522,31831360281,54145147464,64517020844

%N Number of partitions of p=prime(n) into aliquant parts (i.e., parts that do not divide p, meaning any part except 1 and p).

%H Alois P. Heinz, <a href="/A260798/b260798.txt">Table of n, a(n) for n = 1..2000</a> (first 781 terms from Reinhard Zumkeller)

%e 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.

%p b:= proc(n, i) option remember; `if`(n=0 or i=2, 1-irem(n, 2),

%p `if`(i<2, 0, b(n, i-1)+b(n-i, min(i, n-i))))

%p end:

%p a:= n-> (p-> b(p, p-1))(ithprime(n)):

%p seq(a(n), n=1..45); # _Alois P. Heinz_, Mar 11 2018

%t 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]]]];

%t a[n_] := b[#, # - 1]&[Prime[n]];

%t Table[a[n], {n, 1, 45}] (* _Jean-François Alcover_, May 20 2018, after _Alois P. Heinz_ *)

%o (Haskell)

%o import Data.MemoCombinators (memo2, integral)

%o a260798 n = a260798_list !! (n-1)

%o a260798_list = map (subtract 1 . pMemo 2) a000040_list where

%o pMemo = memo2 integral integral p

%o p _ 0 = 1

%o p k m | m < k = 0

%o | otherwise = pMemo k (m - k) + pMemo (k + 1) m

%o -- _Reinhard Zumkeller_, Aug 09 2015

%Y This is A098743(prime(n)). Cf. A260797.

%Y Cf. A000040, A058698.

%K nonn

%O 1,4

%A _Marc LeBrun_ and _N. J. A. Sloane_, Aug 07 2015