-
Notifications
You must be signed in to change notification settings - Fork 0
/
count.py
96 lines (57 loc) · 1.7 KB
/
count.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import enumerate
def cardinality ( iterable ) :
try:
return len(iterable)
except TypeError:
return sum(map(lambda x: 1, iterable))
def fixed(n):
"""
>>> fixed(9)
9910
>>> from oeis import A001168
>>> all(map(lambda n: fixed(n) == A001168[n], range(10)))
True
"""
return cardinality(enumerate._redelmeier(n))
def free(n):
"""
>>> from oeis import A000105
>>> all(map(lambda n: free(n) == A000105[n], range(10)))
True
"""
return cardinality(enumerate._free_mem(n))
def one_sided(n):
"""
>>> from oeis import A000988
>>> all(map(lambda n: one_sided(n) == A000988[n], range(10)))
True
"""
return cardinality(enumerate._one_sided_mem(n))
def chiral(n):
"""
>>> from oeis import A030228
>>> all(map(lambda n: chiral(n) == A030228[n], range(10)))
True
"""
return cardinality(enumerate._chiral_mem(n))
def with_holes(n):
"""
>>> from oeis import A001419
>>> all(map(lambda n: with_holes(n) == A001419[n], range(10)))
True
"""
return cardinality(enumerate._with_holes_mem(n))
def without_holes(n):
"""
>>> from oeis import A000104
>>> all(map(lambda n: without_holes(n) == A000104[n], range(10)))
True
"""
return cardinality(enumerate._without_holes_mem(n))
def free_without_holes_with_odd_side_length(n):
"""
>>> from oeis import A217595
>>> all(map(lambda n: free_without_holes_with_odd_side_length(n) == A217595[n], range(10)))
True
"""
return cardinality(enumerate._free_without_holes_with_odd_side_length_mem(n))