OFFSET
0,6
COMMENTS
LINKS
Peter Luschny, The perfect ruler pyramid
Peter Luschny, Perfect rulers
EXAMPLE
Triangle starts:
0;
0, 1;
0, 1, 2;
0, 1, 3;
0, 1, 2, 4;
0, 1, 2, 5;
0, 1, 4, 6;
0, 1, 2, 3, 7;
0, 1, 2, 5, 8;
0, 1, 2, 6, 9;
0, 1, 2, 3, 6, 10;
0, 1, 2, 3, 7, 11;
0, 1, 2, 3, 8, 12;
0, 1, 2, 6, 10, 13;
0, 1, 2, 3, 4, 9, 14;
0, 1, 2, 3, 4, 10, 15;
0, 1, 2, 3, 8, 12, 16;
PROG
(Sage)
def Partsum(T) :
return [add([T[j] for j in range(i)]) for i in (0..len(T))]
def Ruler(L, S) :
return map(Partsum, Compositions(L, length=S))
def isComplete(R) :
S = Set([])
L = len(R)-1
for i in range(L, 0, -1) :
for j in (1..i) :
S = S.union(Set([R[i]-R[i-j]]))
return len(S) == R[L]
def CompleteRuler(L, S) :
return list(filter(isComplete, Ruler(L, S)))
def PerfectRulers(L) :
for i in (0..L) :
R = CompleteRuler(L, i)
if R: return R
return []
def A308999list(L):
for n in (0..L):
print(PerfectRulers(n)[-1])
A308999list(16) # Peter Luschny, Aug 21 2019
CROSSREFS
KEYWORD
nonn,tabf
AUTHOR
Bob Selcoe, Jul 04 2019
STATUS
approved