| 1 | initial version |
You can use the standard Paritions() functionality by specifying allowed parts as not multiples of k below n:
def k_regular_partitions(n,k):
return Partitions(n,parts_in=[i for i in range(1,n+1) if i%k]).cardinality()
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.