OFFSET
0,2
LINKS
Andrew Howroyd, Table of n, a(n) for n = 0..50
PROG
(Python)
from sets import Set
from numpy import array
def toBinary(n, k):
ans=[]
for i in range(k):
ans.insert(0, n%2)
n=n>>1
return array(ans)
def powerSet(k): return [toBinary(n, k) for n in range(1, 2**k)]
def courcelle(maxUses, remainingSets, exact=False):
if exact and not all(maxUses<=sum(remainingSets)): ans=0
elif len(remainingSets)==0: ans=1
else:
set0=remainingSets[0]
if all(set0<=maxUses): ans=courcelle(maxUses-set0, remainingSets[1:], exact=exact)
else: ans=0
ans+=courcelle(maxUses, remainingSets[1:], exact=exact)
return ans
for i in range(10):
print(i, courcelle(array([4]*i), powerSet(i), exact=False))
(PARI) \\ See A330964 for efficient code to compute this sequence. - Andrew Howroyd, Jan 04 2020
CROSSREFS
KEYWORD
nonn
AUTHOR
Daniel E. Loeb, Dec 17 2010
EXTENSIONS
a(6)-a(8) from Bert Dobbelaere, Sep 10 2019
Terms a(9) and beyond from Andrew Howroyd, Jan 04 2020
STATUS
approved