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

Home > Numbers
Digit permutation (Posted on 2013-03-03) Difficulty: 3 of 5
735 is a 3-digit base ten positive integer formed by a permutation of the digits 3, 5 and 7 and, 735 is divisible by each of 3, 5 and 7.

Determine the minimum value of N with N ≥ 11 such that there exists a 3-digit base-N positive integer p which is formed by a permutation of the digits 3, 5 and 7 such that p is divisible by each of 3, 5 and 7. What is the next smallest value of N with this property?

No Solution Yet Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 3 |

DECLARE SUB factor (num#, s$)
DECLARE SUB permute (a$)
DEFDBL A-Z
CLS
FOR n = 11 TO 500
   s$ = "357"
   h$ = s$
   DO
     v = VAL(LEFT$(s$, 1)) * n * n + VAL(MID$(s$, 2, 1)) * n + VAL(RIGHT$(s$, 1))
     IF v MOD 3 = 0 AND v MOD 5 = 0 AND v MOD 7 = 0 THEN
        factor v, fct$
        PRINT n, s$, v, fct$
        ct = ct + 1
     END IF
     permute s$
   LOOP UNTIL s$ = h$
   IF ct >= 45 THEN EXIT FOR
NEXT n

SUB factor (num, s$)
 s$ = "": n = ABS(num): IF n > 0 THEN limit = SQR(n):  ELSE limit = 0
 IF limit <> INT(limit) THEN limit = INT(limit + 1)
 dv = 2: GOSUB DivideIt
 dv = 3: GOSUB DivideIt
 dv = 5: GOSUB DivideIt
 dv = 7
 DO UNTIL dv > limit
   GOSUB DivideIt: dv = dv + 4 '11
   GOSUB DivideIt: dv = dv + 2 '13
   GOSUB DivideIt: dv = dv + 4 '17
   GOSUB DivideIt: dv = dv + 2 '19
   GOSUB DivideIt: dv = dv + 4 '23
   GOSUB DivideIt: dv = dv + 6 '29
   GOSUB DivideIt: dv = dv + 2 '31
   GOSUB DivideIt: dv = dv + 6 '37
   IF INKEY$ = CHR$(27) THEN s$ = CHR$(27): EXIT SUB
 LOOP
 IF n > 1 THEN s$ = s$ + STR$(n)
 EXIT SUB

DivideIt:
 DO
  q = INT(n / dv)
  IF q * dv = n AND n > 0 THEN
    n = q: s$ = s$ + STR$(dv): IF n > 0 THEN limit = SQR(n):  ELSE limit = 0
    IF limit <> INT(limit) THEN limit = INT(limit + 1)
   ELSE
    EXIT DO
  END IF
 LOOP
 RETURN
END SUB

finds

base    representation    decimal          factors  
                         equivalent
19           753            2625          3 5 5 5 7
26           537            3465          3 3 5 7 11
31           357            3045          3 5 7 29
31           735            6825          3 5 5 7 13
49           357            7455          3 5 7 71
54           753            20685         3 5 7 197
56           537            15855         3 5 7 151
61           537            18795         3 5 7 179
61           753            26355         3 5 7 251
80           735            45045         3 3 5 7 11 13
91           357            25305         3 5 7 241
91           537            41685         3 5 7 397
94           357            26985         3 5 7 257
96           753            64995         3 5 7 619
101          735            71715         3 5 7 683
115          735            92925         3 3 5 5 7 59
124          753            108255        3 5 7 1031
131          537            86205         3 5 7 821
136          357            56175         3 5 5 7 107
136          735            129885        3 5 7 1237
154          357            71925         3 5 5 7 137
159          753            177765        3 5 7 1693
161          537            130095        3 3 5 7 7 59
166          537            138285        3 3 5 7 439
166          753            193725        3 3 3 5 5 7 41
185          735            240135        3 5 7 2287
196          357            116235        3 3 3 3 5 7 41
196          537            192675        3 5 5 7 367
199          357            119805        3 5 7 7 163
201          753            283815        3 3 5 7 17 53
206          735            297675        3 3 3 3 3 5 5 7 7
220          735            339465        3 5 7 53 61
229          753            368235        3 3 5 7 7 167
236          537            279195        3 5 7 2659
241          357            175455        3 3 5 7 557
241          735            407295        3 3 3 5 7 431
259          357            202545        3 3 5 7 643
264          753            489195        3 3 5 7 1553
266          537            354585        3 5 7 11 307
271          537            368025        3 5 5 7 701
271          753            515445        3 5 7 4909
290          735            589575        3 5 5 7 1123
301          357            273315        3 5 7 19 137
301          537            453915        3 3 5 7 11 131
304          357            278775        3 3 3 5 5 7 59

  Posted by Charlie on 2013-03-03 12:17:56
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (15)
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