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

Home > Just Math
Digits 1-7 (Posted on 2009-03-30) Difficulty: 2 of 5
A seven digit positive octal integer X is constituted by arranging the nonzero octal digits 1-7 in some order, so that:
  • The octal number formed by the first two digits is divisible by 2.
  • The octal number formed by the first three digits is divisible by 3.
  • The octal number formed by the first four digits is divisible by 4.
  • and, so on up to seven digits...
Determine all possible value(s) that X can assume.

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 | Comment 1 of 6

DECLARE FUNCTION oct2dec# (o$)
DEFDBL A-Z
DECLARE SUB permute (a$)
CLS
dig$ = "1234567"
h$ = dig$
DO
 IF oct2dec(LEFT$(dig$, 2)) MOD 2 = 0 THEN
 IF oct2dec(LEFT$(dig$, 3)) MOD 3 = 0 THEN
 IF oct2dec(LEFT$(dig$, 4)) MOD 4 = 0 THEN
 IF oct2dec(LEFT$(dig$, 5)) MOD 5 = 0 THEN
 IF oct2dec(LEFT$(dig$, 6)) MOD 6 = 0 THEN
 IF oct2dec(LEFT$(dig$, 7)) MOD 7 = 0 THEN
  PRINT dig$;
  PRINT oct2dec(LEFT$(dig$, 2));
  PRINT oct2dec(LEFT$(dig$, 3));
  PRINT oct2dec(LEFT$(dig$, 4));
  PRINT oct2dec(LEFT$(dig$, 5));
  PRINT oct2dec(LEFT$(dig$, 6));
  PRINT oct2dec(LEFT$(dig$, 7))
 END IF
 END IF
 END IF
 END IF
 END IF
 END IF

 permute dig$
LOOP UNTIL h$ = dig$

FUNCTION oct2dec (o$)
 v = 0
 FOR i = 1 TO LEN(o$)
  v = v * 8 + VAL(MID$(o$, i, 1))
 NEXT
 oct2dec = v
END FUNCTION

finds three values:

3254167 26  213  1708  13665  109326  874615
5234761 42  339  2716  21735  173886  1391089
5674321 46  375  3004  24035  192282  1538257

where the first column is the octal number, and the remaining columns show the decimal equivalents of the first 2, 3, 4, 5, 6 and 7 digits.


  Posted by Charlie on 2009-03-30 13:47:39
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 (11)
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