The Frobenius Coin Problem
Alice is shopping at a magical market where every possible price exists as an item - there's an item priced at $1, $2, $3, and so on infinitely. She has two types of coins with prime denominations: primeOne and primeTwo, and she has an infinite supply of both.
Alice wants to find the most expensive item that she cannot possibly buy using any combination of her two coin types. This is a classic problem in number theory known as the Frobenius problem.
Example: If Alice has coins of denominations 3 and 5, she cannot buy items priced at 1, 2, 4, or 7, but she can buy everything from 8 onwards. So the answer would be 7.
Goal: Return the price of the most expensive item Alice cannot buy.
Input & Output
Constraints
- 2 โค primeOne, primeTwo โค 103
- primeOne and primeTwo are distinct prime numbers
- The result will always be a positive integer