All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 The magic Number (Posted on 2004-03-17)
Whats the smallest number ("the magic number") that can satisfy these conditions?

- its positive

- it is not divisible by any number below 20 (excluding 1)

- the average of the digits is an even number between 3 and 9

 See The Solution Submitted by Victor Zapana Rating: 3.3333 (9 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 solution | Comment 7 of 35 |

53 is found by:

DATA 2,3,5,7,11,13,17,19
DIM pr(8)
FOR i = 1 TO 8
NEXT
i = 20
DO
i = i + 1
good = 1
FOR j = 1 TO 8
q = i \ pr(j)
IF q * pr(j) = i THEN good = 0: EXIT FOR
NEXT
IF good THEN
n\$ = LTRIM\$(STR\$(i))
l = LEN(n\$)
s = 0
FOR j = 1 TO l
s = s + VAL(MID\$(n\$, j, 1))
NEXT
avg = s / l
IF avg = INT(avg) THEN
IF avg MOD 2 = 0 AND avg > 2 AND avg < 9 THEN
PRINT i
ct = ct + 1
IF ct = 40 THEN END
END IF
END IF
END IF
LOOP

which also finds larger numbers:

53
71
79
97
1069
1087
1249
1357
1429
1447
1483
1537
1591
1609
1627
1663
1681
1753
1861
1933
1951
2059
2077
2239
2257
2293
2347
2383
2419
2437
2473
2491
2581
2617
2671
2707
2833
2851
2923
3049

 Posted by Charlie on 2004-03-17 08:47:37

 Search: Search body:
Forums (0)