I am a three digit number.
I am either divisible by 3 or by 5.
I am either divisible by 4 or by 6.
I am either divisible by 5 or by 7.
I am either divisible by 6 or by 8.
I am either divisible by 7 or by 9.
I am either divisible by 9 or by 11.
What am I?
(Note: "divisible" means leaving no remainder.)
(In reply to
That depends on what "or" is -- computer solution by Charlie)
FOR n = 100 TO 999
IF n MOD 3 = 0 XOR n MOD 5 = 0 THEN
IF n MOD 4 = 0 XOR n MOD 6 = 0 THEN
IF n MOD 5 = 0 XOR n MOD 7 = 0 THEN
IF n MOD 6 = 0 XOR n MOD 8 = 0 THEN
IF n MOD 7 = 0 XOR n MOD 9 = 0 THEN
IF n MOD 9 = 0 XOR n MOD 11 = 0 THEN
PRINT n
END IF
END IF
END IF
END IF
END IF
END IF
NEXT
does indeed produce 462.
|
Posted by Charlie
on 2006-05-13 12:25:52 |