Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Returns the cardinality of the multiplicative partition set for an integer (in PARI/GP)
/*
Returns the number of multiplicative partitions of integer n
Ref: https://oeis.org/A001055
https://oeis.org/A162247
https://oeis.org/A162247/a162247.txt
Inputs:
n: Non-negative integer
m: Maximum factor (optional)
Output:
V: Vector of multiplicative partitions of n
Example:
mnumbpart(60) = 11
Written by: John Peach 29-Dec-2020
Modified from fcnt function by Michael B. Porter (Oct 29 2009), https://oeis.org/A001055
*/
mnumbpart(n,m = n) =
{
local(s);
s=0;
if(n==1,s=1,
fordiv(n,d,if(d>1&d<=m,s=s+mnumbpart(n/d,d)))
);
return(s);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment