 All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars  perplexus dot info  Round Results (Posted on 2013-08-05) In how many ways can you select a set of six distinct integers, each having absolute value below 51 to yield a product which is an integer power of 10?

 No Solution Yet Submitted by Ady TZIDON No Rating Comments: ( Back to comment list | You must be logged in to post comments.) re: a few more Comment 4 of 4 | (In reply to a few more by Steve Herman)

Indeed I had neglected that allowing negative numbers also allows duplicates of a given absolute value. There are 1852 ways altogether.

By power of 10 they are

`power of 10   number    3          20    4         152    5         440    6         632    7         458    8         140    9          10`

DEFDBL A-Z
DIM lct(25)
CLS
FOR a = -50 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 pow10 = LEN(s\$) - 1: lct(pow10) = lct(pow10) + 1: 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

FOR i = 0 TO 10: PRINT i, lct(i): NEXT
PRINT ct

 Posted by Charlie on 2013-08-05 22:17:25 Please log in:

 Search: Search body:
Forums (0)