type CoinCount = { Coin : Coin; Count : int }
let rec getCoinCount input (coins : CoinCount list) =
| i when i >= quarterValue ->
let rem = i / quarterValue
let mid = 1 - rem * quarterValue
getCoinCount mid ({Coin = Coin.Quarter; Count = rem } :: coins)
| i when i >= dimeValue ->
let mid = 1 - rem * dimeValue
getCoinCount mid ({Coin = Coin.Dime; Count = rem } :: coins)
| i when i >= nickelValue ->
let rem = i / nickelValue
let mid = i - rem * nickelValue
getCoinCount mid ({Coin = Coin.Nickel; Count = rem } :: coins)
| i when i >= pennyValue ->
let mid = i - rem * nickelValue
getCoinCount mid ({ Coin = Coin.Penny; Count = rem } :: coins)
let coins = getCoinCount value []
printf "For the value %d, here are the coins required:\r\n" value
|> Seq.iter (fun c -> printf "%d of type %A\r\n" c.Count c.Coin)