login
A171978
Number of partitions of n into fractions k/(k+1), 0<k<=n.
2
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
OFFSET
0,3
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).
EXAMPLE
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.
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 *)
PROG
(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
CROSSREFS
Sequence in context: A102984 A103017 A091833 * A290571 A026080 A071795
KEYWORD
more,nonn
AUTHOR
Reinhard Zumkeller, Jan 20 2010
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
STATUS
approved