First time here? Check out the FAQ!

Ask Your Question
0

k-regular Partitions

asked 1 year ago

Tobi gravatar image

I'm looking for a code, to calculate the number of k-regular Partitions, of a positiv integer n. A k-regular Partition is a Partition, in which no summand is a multiple of k.

Hopefully someone has an idea! I am using the online Version of SageMath.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 1 year ago

Max Alekseyev gravatar image

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()
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 1 year ago

Seen: 145 times

Last updated: Dec 26 '23