2018-09-30 22:01:58 +00:00
---
id: 5900f4861000cf542c50ff98
title: 'Problem 281: Pizza Toppings'
2020-11-27 18:02:05 +00:00
challengeType: 5
2019-08-05 16:17:33 +00:00
forumTopicId: 301932
2021-01-13 02:31:00 +00:00
dashedName: problem-281-pizza-toppings
2018-09-30 22:01:58 +00:00
---
2020-11-27 18:02:05 +00:00
# --description--
2018-09-30 22:01:58 +00:00
2021-07-22 03:38:46 +00:00
You are given a pizza (perfect circle) that has been cut into $m·n$ equal pieces and you want to have exactly one topping on each slice.
2018-09-30 22:01:58 +00:00
2021-07-22 03:38:46 +00:00
Let $f(m,n)$ denote the number of ways you can have toppings on the pizza with $m$ different toppings ($m ≥ 2$), using each topping on exactly $n$ slices ($n ≥ 1$). Reflections are considered distinct, rotations are not.
2018-09-30 22:01:58 +00:00
2021-07-22 03:38:46 +00:00
Thus, for instance, $f(2,1) = 1$, $f(2,2) = f(3,1) = 2$ and $f(3,2) = 16$. $f(3,2)$ is shown below:
2018-09-30 22:01:58 +00:00
2021-07-22 03:38:46 +00:00
< img class = "img-responsive center-block" alt = "animation with 16 ways to have 3 different toppings on 2 slices each" src = "https://cdn.freecodecamp.org/curriculum/project-euler/pizza-toppings.gif" style = "background-color: white; padding: 10px;" >
Find the sum of all $f(m,n)$ such that $f(m,n) ≤ {10}^{15}$.
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
# --hints--
2018-09-30 22:01:58 +00:00
2021-07-22 03:38:46 +00:00
`pizzaToppings()` should return `1485776387445623` .
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
```js
2021-07-22 03:38:46 +00:00
assert.strictEqual(pizzaToppings(), 1485776387445623);
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --seed--
2018-09-30 22:01:58 +00:00
2020-11-27 18:02:05 +00:00
## --seed-contents--
2018-09-30 22:01:58 +00:00
```js
2021-07-22 03:38:46 +00:00
function pizzaToppings() {
2020-09-15 16:57:40 +00:00
2018-09-30 22:01:58 +00:00
return true;
}
2021-07-22 03:38:46 +00:00
pizzaToppings();
2018-09-30 22:01:58 +00:00
```
2020-11-27 18:02:05 +00:00
# --solutions--
2018-09-30 22:01:58 +00:00
```js
// solution required
```