DEFDBL A-Z
DIM dg(100)
FOR p = 2 TO 2001
n = 2009
sod = 0
psn = 0
DO
d = n MOD p
dg(psn) = d
psn = psn + 1
sod = sod + d
n = n \ p
LOOP UNTIL n = 0
IF sod = 11 THEN
PRINT p;
FOR i = psn - 1 TO 0 STEP -1
IF dg(i) = 10 THEN
PRINT "X";
ELSE
PRINT LTRIM$(STR$(dg(i)));
END IF
NEXT
PRINT
END IF
NEXT
No higher digit than that with value ten is possible, so the program uses X (as in the roman numeral) to represent that digit. (2009 is not divisible by 11, so it can't be just a single value-eleven digit followed by zeros.)
base representation
4 133121
7 5600
10 2009
223 92
334 65
667 38
1000 29
1999 1X
(list reformatted manually)
That's 8 possible hits out of 2000 possible choices, for a probability of 1/250.
|
Posted by Charlie
on 2010-03-13 13:14:21 |