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

 Product Digit Poser (Posted on 2010-06-13)
Determine all possible values of a positive integer N such that the product of the nonzero digits in the base-N representation of 2009 (base ten) is equal to 18 (base ten).

 No Solution Yet Submitted by K Sengupta No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
 computer solution (spoiler) | Comment 1 of 5

DEFDBL A-Z
CLS
num = 2009
goal = 18
REDIM dgt(10)
FOR n = 3 TO num
v = num
prod = 1
dCt = 0
ERASE dgt
REDIM dgt(10)
DO
dig = v MOD n
v = v \ n
IF dig > 0 THEN
prod = prod * dig
END IF
dgt(dCt) = dig
dCt = dCt + 1
LOOP UNTIL prod > goal OR v = 0
IF v = 0 AND prod = goal THEN
PRINT n; ":  ";
FOR i = dCt - 1 TO 0 STEP -1
PRINT dgt(i);
NEXT
PRINT
END IF
NEXT

finds five bases where this works:

`base     representation 4 :   1  3  3  1  2  1 10 :   2  0  0  9 223 :   9  2 1000 :   2  9 1991 :   1  18`

Note that 18 is used in this last as a base-1991 digit, rather than using the alphabetic representation of digits beyond 9.

 Posted by Charlie on 2010-06-13 14:43:10

 Search: Search body:
Forums (1)