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

Home > Numbers
Adjacently Greater Than One (Posted on 2010-01-01) Difficulty: 2 of 5
Determine all possible values of a 6-digit positive integer N having 6 different digits from 0 to 9, with the first digit being nonzero, such that:

(i) Either, the digits at the even positions are even and the digits at the odd positions are odd – or, the digits at the even positions are odd and the digits at the odd positions are even. Zero is regarded as an even digit.

(ii) The absolute difference between two adjacent digits is always greater than one.

(iii) The 2-digit number formed by the first and second digit as well as the 2-digit number formed by the third and fourth digit is divisible by the 2-digit number formed by the fifth and sixth digit.

See The Solution Submitted by K Sengupta    
Rating: 3.3333 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution A computer program listing and spoiler Comment 6 of 6 |

DEFDBL A-Z
FOR a = 1 TO 9
 used(a) = 1
FOR b = 0 TO 9
 IF used(b) = 0 AND (a + b) MOD 2 = 1 AND ABS(a - b) > 1 THEN
  used(b) = 1
FOR c = 0 TO 9
 IF used(c) = 0 AND (c + b) MOD 2 = 1 AND ABS(b - c) > 1 THEN
  used(c) = 1
FOR d = 0 TO 9
 IF used(d) = 0 AND (c + d) MOD 2 = 1 AND ABS(c - d) > 1 THEN
  used(d) = 1
FOR e = 0 TO 9
 IF used(e) = 0 AND (d + e) MOD 2 = 1 AND ABS(d - e) > 1 THEN
  used(e) = 1
FOR f = 0 TO 9
 IF used(f) = 0 AND (e + f) MOD 2 = 1 AND ABS(e - f) > 1 THEN
  used(f) = 1

  ab = 10 * a + b
  cd = 10 * c + d
  ef = 10 * e + f
  IF ab MOD ef = 0 AND cd MOD ef = 0 THEN
    PRINT a; b; c; d; e; f
  END IF

  used(f) = 0
 END IF
NEXT
  used(e) = 0
 END IF
NEXT
  used(d) = 0
 END IF
NEXT
  used(c) = 0
 END IF
NEXT
  used(b) = 0
 END IF
NEXT
 used(a) = 0
NEXT

finds the previously given

4  9  6  3  0  7
6  9  2  7  0  3
8  1  6  3  0  9
8  1  6  9  0  3
9  0  3  6  1  8

I note that KS did not specifically forbid leading zeros from the 2-digit numbers (whereas he had from the 6-digit number), so there could be a difference of opinion about the validity of the first four solutions.


  Posted by Charlie on 2010-01-01 14:01:25
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 (3)
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