You are doing modulus zero
here:
if ( 130816 % number == 0 )
which is undefined behavior. If you start your for loop at 1
instead it should fix that issue. However, since N % 1 == 0
for all N
, you probably need to start at 2
.
From the C99
standard, 6.5.5 /5
(unchanged in C11
):
The result of the / operator is the quotient from the division of the first operand by the second; the result of the % operator is the remainder. In both operations, if the value of the second operand is zero, the behavior is undefined.