DEFDBL A-Z
CLS
FOR a = 1 TO 45
IF a MOD 3 > 0 AND a MOD 7 > 0 AND a MOD 11 > 0 AND a MOD 13 > 0 THEN
FOR b = a + 1 TO 46
IF b MOD 3 > 0 AND b MOD 7 > 0 AND b MOD 11 > 0 AND b MOD 13 > 0 THEN
FOR c = b + 1 TO 47
IF c MOD 3 > 0 AND c MOD 7 > 0 AND c MOD 11 > 0 AND c MOD 13 > 0 THEN
abc = a * b * c
FOR d = c + 1 TO 48
IF d MOD 3 > 0 AND d MOD 7 > 0 AND d MOD 11 > 0 AND d MOD 13 > 0 THEN
FOR e = d + 1 TO 49
IF e MOD 3 > 0 AND e MOD 7 > 0 AND e MOD 11 > 0 AND e MOD 13 > 0 THEN
FOR f = e + 1 TO 50
IF f MOD 3 > 0 AND f MOD 7 > 0 AND f MOD 11 > 0 AND f MOD 13 > 0 THEN
prod = abc * d * e * f
s$ = LTRIM$(STR$(prod))
IF LEFT$(s$, 1) = "1" THEN
good = 1
FOR i = 2 TO LEN(s$)
IF MID$(s$, i, 1) <> "0" THEN good = 0: EXIT FOR
NEXT i
IF good THEN ct = ct + 1: PRINT a; b; c; d; e; f, prod
END IF
END IF
NEXT f
END IF
NEXT e
END IF
NEXT d
END IF
NEXT c
END IF
NEXT b
END IF
NEXT a
PRINT ct
finds these 18 positive results:
1 2 4 5 10 25 10000
1 2 4 10 25 50 100000
1 2 5 8 25 50 100000
1 2 5 10 20 50 100000
1 2 5 10 25 40 100000
1 2 10 25 40 50 1000000
1 4 5 10 20 25 100000
1 4 5 25 40 50 1000000
1 4 10 20 25 50 1000000
1 5 8 20 25 50 1000000
1 5 10 16 25 50 1000000
1 5 10 20 25 40 1000000
1 10 20 25 40 50 10000000
2 4 5 20 25 50 1000000
2 5 8 10 25 50 1000000
2 5 20 25 40 50 10000000
4 5 10 25 40 50 10000000
5 8 10 20 25 50 10000000
Since the integers need not be positive, but the product, being a power of positive 10 does need to be positive, any 2 or 4 or all six of the integers could be negative.
So each of the 18 shown results can be turned into a set of positive and negative numbers:
All positive: 1
C(6,2): 15
C(6,4): 15
All negative: 1
---
32
The final answer is 18*32 = 576.
Edited on August 5, 2013, 9:54 pm
|
Posted by Charlie
on 2013-08-05 13:36:27 |