A171978 Number of partitions of n into fractions k/(k+1), 0 < k <= n.
1, 1, 2, 4, 7, 22, 37, 84, 172, 454, 745, 2904, 4722, 10464, 38546, 88769, 147439, 475153, 785894, 3140342, 10412267, 19169464, 32132160, 125087460, 224341028, 394553026, 799614318, 3108061596, 5172450911, 21360507716, 35407697816, 81523452326, 238510777299
Offset: 0
Keywords
Examples
a(3) = 4 partitions into parts 1/2, 2/3, or 3/4: #1: 3/4 + 3/4 + 3/4 + 3/4 = 3, #2: (3/4 + 3/4) + (1/2 + 1/2 + 1/2) = 3, #3: (2/3 + 2/3 + 2/3) + (1/2 + 1/2) = 3, #4: 1/2 + 1/2 + 1/2 + 1/2 + 1/2 + 1/2 = 3; a(4) = 7 partitions into parts 1/2, 2/3, 3/4, or 4/5: #1: 4/5 + 4/5 + 4/5 + 4/5 + 4/5 = 4, #2: (3/4 + 3/4 + 3/4 + 3/4) + (1/2 + 1/2) = 4, #3: (3/4 + 3/4) + (2/3 + 2/3 + 2/3) + 1/2 = 4, #4: (3/4 + 3/4) + (1/2 + 1/2 + 1/2 + 1/2 + 1/2) = 4, #5: 2/3 + 2/3 + 2/3 + 2/3 + 2/3 + 2/3 = 4, #6: (2/3 + 2/3 + 2/3) + (1/2 + 1/2 + 1/2 + 1/2) = 4, #7: 1/2 + 1/2 + 1/2 + 1/2 + 1/2 + 1/2 + 1/2 + 1/2 = 4.
Programs
-
Haskell
-- import Data.Ratio ((%)) a171978 n = q (fromInteger n) $ zipWith (%) [1..n] [2..] where q 0 _ = 1 q _ [] = 0 q x ks'@(k:ks) | x < k = fromEnum (x == 0) | otherwise = q (x - k) ks' + q x ks -- Reinhard Zumkeller, Apr 01 2012
-
Maple
b:= proc(n, k) option remember; `if`(n=0, 1, `if`(k=0 or isprime(k+2) and irem(denom(n), k+2)=0, 0, b(n, k-1)+`if`(k>k*n+n, 0, b(n-k/(k+1), k)))) end: a:= n-> b(n, n): seq(a(n), n=0..16); # Alois P. Heinz, Jul 18 2012
-
Mathematica
b[n_, k_] := b[n, k] = If[n==0, 1, If[k==0 || PrimeQ[k+2] && Mod[ Denominator[n], k+2]==0, 0, b[n, k-1] + If[k>k*n+n, 0, b[n-k/(k+1), k]]] ]; a[n_] := b[n, n]; Table[a[n], {n, 0, 16}] (* Jean-François Alcover, Feb 16 2017, after Alois P. Heinz *)
Formula
a(n) = q(n, 1) with q(x, k) = if x < k/(k+1) then 0^x else if k > n then 0 else q(x-k/(k+1), k) + q(x, k+1).
Extensions
Offset corrected and a(16) added by Reinhard Zumkeller, Apr 01 2012
a(17)-a(23) from Alois P. Heinz, Jul 18 2012
a(24) from Alois P. Heinz, Sep 27 2014
a(25)-a(32) from Jinyuan Wang, Dec 13 2024