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

Home > Numbers
Ordinal Days (Posted on 2010-02-17) Difficulty: 3 of 5
If the days of the week are represented as follows:

MO TU W TH F SA SU

and are numbered 1 to 7 as follows:

MO TU  W TH  F SA SU
 1  2  3  4  5  6  7

assign to each letter a non-zero digit so that the numbers represented by the day abbreviations given are each divisible by the digit assigned to that day, but by no higher digit.

  Submitted by Charlie    
Rating: 2.5000 (2 votes)
Solution: (Hide)
MO TU  W TH  F SA SU
89 74  3 76  5 12 14

w = 3: f = 5
used(3) = 1: used(5) = 1
FOR m = 1 TO 9
 IF used(m) = 0 THEN
   used(m) = 1
FOR o = 1 TO 9
 IF used(o) = 0 THEN
   used(o) = 1
   mo = m * 10 + o
   good = 1
   FOR i = 2 TO 7
     IF mo MOD i = 0 THEN good = 0: EXIT FOR
   NEXT i
   IF good THEN

FOR t = 1 TO 9
 IF used(t) = 0 THEN
   used(t) = 1
FOR u = 1 TO 9
 IF used(u) = 0 THEN
   used(u) = 1

   tu = t * 10 + u
   good = 1
   FOR i = 3 TO 7
     IF tu MOD i = 0 THEN good = 0: EXIT FOR
   NEXT i
   IF tu MOD 2 = 0 AND good = 1 THEN

FOR h = 1 TO 9
 IF used(h) = 0 THEN
   used(h) = 1

   th = t * 10 + h
   good = 1
   FOR i = 5 TO 9
     IF th MOD i = 0 THEN good = 0: EXIT FOR
   NEXT i
   IF th MOD 4 = 0 AND good = 1 THEN

FOR s = 1 TO 9
 IF used(s) = 0 THEN
   used(s) = 1
FOR a = 1 TO 9
 IF used(a) = 0 THEN
   used(a) = 1

   sa = s * 10 + a
   good = 1
   FOR i = 7 TO 9
     IF sa MOD i = 0 THEN good = 0: EXIT FOR
   NEXT i
   IF sa MOD 6 = 0 AND good = 1 THEN


   su = s * 10 + u
   good = 1
   FOR i = 8 TO 9
     IF su MOD i = 0 THEN good = 0: EXIT FOR
   NEXT i
   IF su MOD 7 = 0 AND good = 1 THEN
     PRINT mo; tu; w; th; f; sa; su
   END IF

   used(a) = 0

   END IF

   used(a) = 0
 END IF
NEXT
   used(s) = 0
 END IF
NEXT

   END IF

   used(h) = 0
 END IF
NEXT

   END IF

   used(u) = 0
 END IF
NEXT
   used(t) = 0
 END IF
NEXT

   END IF
   used(o) = 0
 END IF
NEXT
   used(m) = 0
 END IF
NEXT


Based upon Enigma No. 1575, "All our days", by Adrian Somerfield, New Scientist, 12 December 2009, page 28.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
SolutionSolutionDej Mar2010-02-18 03:40:26
Some Thoughtsre(2): SPOILERAdy TZIDON2010-02-17 15:47:07
re: SPOILERJustin2010-02-17 15:01:26
SolutionSPOILERAdy TZIDON2010-02-17 13:49:51
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 (0)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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