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

 Digit permutation (Posted on 2013-03-03)
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.)
 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 726           537            3465          3 3 5 7 1131           357            3045          3 5 7 2931           735            6825          3 5 5 7 1349           357            7455          3 5 7 7154           753            20685         3 5 7 19756           537            15855         3 5 7 15161           537            18795         3 5 7 17961           753            26355         3 5 7 25180           735            45045         3 3 5 7 11 1391           357            25305         3 5 7 24191           537            41685         3 5 7 39794           357            26985         3 5 7 25796           753            64995         3 5 7 619101          735            71715         3 5 7 683115          735            92925         3 3 5 5 7 59124          753            108255        3 5 7 1031131          537            86205         3 5 7 821136          357            56175         3 5 5 7 107136          735            129885        3 5 7 1237154          357            71925         3 5 5 7 137159          753            177765        3 5 7 1693161          537            130095        3 3 5 7 7 59166          537            138285        3 3 5 7 439166          753            193725        3 3 3 5 5 7 41185          735            240135        3 5 7 2287196          357            116235        3 3 3 3 5 7 41196          537            192675        3 5 5 7 367199          357            119805        3 5 7 7 163201          753            283815        3 3 5 7 17 53206          735            297675        3 3 3 3 3 5 5 7 7220          735            339465        3 5 7 53 61229          753            368235        3 3 5 7 7 167236          537            279195        3 5 7 2659241          357            175455        3 3 5 7 557241          735            407295        3 3 3 5 7 431259          357            202545        3 3 5 7 643264          753            489195        3 3 5 7 1553266          537            354585        3 5 7 11 307271          537            368025        3 5 5 7 701271          753            515445        3 5 7 4909290          735            589575        3 5 5 7 1123301          357            273315        3 5 7 19 137301          537            453915        3 3 5 7 11 131304          357            278775        3 3 3 5 5 7 59`

 Posted by Charlie on 2013-03-03 12:17:56

 Search: Search body:
Forums (0)