Project Euler 281 - Pizza Toppings
Official link: https://projecteuler.net/problem=281
Thought Process
This problem was really fun, but mathematically the most challenging problem so far.
I learnt the Cauchy-Frobenius Lemma in Abstract Algebra last semester, and I can without a doubt say it's the most confusing topic i've ever done, but I knew it would be perfect for this problem.
I brushed up on the Pólya enumeration theorem again, and managed to to find out that I was trying to solve was a subset of a problem involving what is referred to as a Necklace in Combinatorics. This page had an explicit formula which is stronger than what actually we need.
Before you read below I recommend reading these StackExchange questions, #1, #2, and the Multinomial Theorem which can ease you into what i'm doing next.
These values get enormous very quickly, to get the answer m ≤ 18, n ≤ 29 is all you need.
I used my phi function which is part of my essential functions.
Interactive Code
Enter a number (yourinput)
Code will output sum of all f(m, n) such that f(m, n) ≤ yourinput