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

 Sum Digit Concern (Posted on 2010-03-13)
For a positive integer P drawn at random between 2 (base ten) and 2001 (base ten) inclusively, determine the probability that the sum of the digits in the base-P representation of 2009 (base ten) is equal to 11 (base ten).

 No Solution Yet Submitted by K Sengupta Rating: 3.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution showing full program with base conversion Comment 2 of 2 |

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 representation4     1331217       560010      2009223       92334       65667       381000      291999      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

 Search: Search body:
Forums (0)