#Python program for sequence A366154 by John Rascoe 10/1/23 from sympy .utilities.iterables import ordered_partitions def A366154(row_n): A = [] for i in range(0,row_n+1): A.append([]) p = list(ordered_partitions(i)) A[i].append(len(p)-0**i) for k1 in range(1,(i+1)//2): c = 0 for j in range(0,len(p)): if len(p[j]) > k1: for k in range(1,len(p[j])): if (p[j][k] - p[j][k-k1]) == k1: c += 1 break A[i].append(c) return(A) print(A366154(10))