For an explanation, refer to the analytical solution submitted by Steve Herman in this location.
Steve Herman has also extended the provisions to negative integers in this location.
blackjack
flooble's webmaster puzzle