Hourglass puzzle: Difference between revisions
Content added Content deleted
Line 34: | Line 34: | ||
println("Flip an hourglass every time it runs out of grains, and note the interval in time.") |
println("Flip an hourglass every time it runs out of grains, and note the interval in time.") |
||
i, j = euclidean_hourglassflipper([4, 7], 9) |
i, j = euclidean_hourglassflipper([4, 7], 9) |
||
println("Use hourglasses from step $i to step $j (inclusive) to sum 9") |
println("Use hourglasses from step $i to step $j (inclusive) to sum 9 using [4, 7]") |
||
i, j = euclidean_hourglassflipper([5, 7, 31], 36) |
|||
println("Use hourglasses from step $i to step $j (inclusive) to sum 36 using [5, 7, 31]") |
|||
</lang>{{out}} |
</lang>{{out}} |
||
<pre> |
<pre> |
||
Flip an hourglass every time it runs out of grains, and note the interval in time. |
Flip an hourglass every time it runs out of grains, and note the interval in time. |
||
Series: [4, 3, 1, 4, 2, 2] |
Series: [4, 3, 1, 4, 2, 2] |
||
Use hourglasses from step 3 to step 6 (inclusive) to sum 9 |
Use hourglasses from step 3 to step 6 (inclusive) to sum 9 using [4, 7] |
||
Series: [5, 2, 3, 4, 1, 5, 1, 4, 3, 2, 1, 4, 5, 2, 3, 4, 1] |
|||
Use hourglasses from step 5 to step 17 (inclusive) to sum 36 using [5, 7, 31] |
|||
</pre> |
</pre> |
||