Project Euler 231 - The prime factorisation of binomial coefficients
Project Euler 231 - The prime factorisation of binomial coefficients
Official link: https://projecteuler.net/problem=231
Thought Process
Thought Process
Knowing that aCb = a!/(b!(a-b)!), I just found the prime factors of a!, b!, and (a-b)! using Legendre's Formula, which is linked in my Essential Functions.
After this I just remove the factors of b! and (a-b)! from a! and then if p^e is in the remaining a! then I add e*p to a total
Interactive Code
Interactive Code
Enter 2 numbers (a, b)
Code will output the sum of the terms in the prime factorisation of aCb