Okay, this one is beyond me: I must be having a long day. Why does (13! mod 10) come out as 4, when the number ends in two 0s??
Try this out:
<?php $thirteen_fac = 6227020800;
echo $thirteen_fac % 10; ?>
Result is 4. Expected 0.
I must be forgetting something exceedingly obvious...
6227020800
is too large for an integer (on a 32 bit system anyway). PHP will store it as float in your variable. The modulo operation will thus use an inexact up/downrounded number as basis.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With