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

Home > Numbers
Product Digit Poser (Posted on 2010-06-13) Difficulty: 3 of 5
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).

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution 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
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information