Ask Your Question
0

k-regular Partitions

asked 2023-12-25 23:08:59 +0100

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-12-26 00:09:14 +0100

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()
edit flag offensive delete link more

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: 2023-12-25 23:08:59 +0100

Seen: 121 times

Last updated: Dec 26 '23