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

Home > Just Math
Decode the double code (Posted on 2011-06-09) Difficulty: 4 of 5
I have multiplied two 3-digit numbers and coded the whole process twice:

In the 1st coding O replaces an odd digit and E the even.
   OOO
 * EOE
  OEOE
  OOO
 OEE  
 OOOEE 
In the 2nd coding S replaces a digit smaller than 6 and B a digit bigger than 5.
   SBB
 * SSB
  SSSB
  SSS
 BSB  
 BBSSB
Try to get my original numbers(digit 9 does not appear in the multiplication) and all other possible solutions, if any.

No Solution Yet Submitted by Ady TZIDON    
Rating: 4.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solutons (spoilers) | Comment 1 of 7

CLS
FOR a = 1 TO 9 STEP 2
FOR b = 1 TO 9 STEP 2
FOR c = 1 TO 9 STEP 2
FOR d = 2 TO 8 STEP 2
FOR e = 1 TO 9 STEP 2
FOR f = 0 TO 8 STEP 2
  abc = 100 * a + 10 * b + c
  m2 = 100 * d + 10 * e + f
  prod = abc * m2
  p1 = f * abc
  p2 = e * abc
  p3 = d * abc
  pr$ = LTRIM$(STR$(prod))
  IF LEN(pr$) = 5 THEN
   good = 1
   FOR i = 1 TO 3
     IF INSTR("13579", MID$(pr$, i, 1)) = 0 THEN good = 0
   NEXT
   FOR i = 4 TO 5
     IF INSTR("02468", MID$(pr$, i, 1)) = 0 THEN good = 0
   NEXT
   IF p1 < 1000 OR p1 > 9999 THEN good = 0
   IF p2 < 100 OR p2 > 999 THEN good = 0
   IF p3 < 100 OR p3 > 999 THEN good = 0
   IF good THEN
     pr1$ = LTRIM$(STR$(p1))
     pr2$ = LTRIM$(STR$(p2))
     pr3$ = LTRIM$(STR$(p3))
     odd$ = MID$(pr1$, 1, 1) + MID$(pr1$, 3, 1) + pr2$ + MID$(pr3$, 1, 1)
     even$ = MID$(pr1$, 2, 1) + MID$(pr1$, 4, 1) + MID$(pr3$, 2)
     FOR i = 1 TO LEN(odd$)
      IF INSTR("13579", MID$(odd$, i, 1)) = 0 THEN good = 0
     NEXT
     FOR i = 1 TO LEN(even$)
      IF INSTR("02468", MID$(even$, i, 1)) = 0 THEN good = 0
     NEXT
     IF good THEN
       PRINT abc: PRINT m2
       PRINT p1: PRINT p2: PRINT p3
       PRINT pr$
       PRINT
       ct = ct + 1
     END IF
   END IF
  END IF

NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
PRINT ct

PRINT

ct = 0
FOR a = 1 TO 5
FOR b = 6 TO 9
FOR c = 6 TO 9
FOR d = 1 TO 5
FOR e = 0 TO 5
FOR f = 6 TO 9
  abc = 100 * a + 10 * b + c
  m2 = 100 * d + 10 * e + f
  prod = abc * m2
  p1 = f * abc
  p2 = e * abc
  p3 = d * abc
  pr$ = LTRIM$(STR$(prod))
  IF LEN(pr$) = 5 THEN
   good = 1
   FOR i = 1 TO 2
     IF INSTR("6789", MID$(pr$, i, 1)) = 0 THEN good = 0
   NEXT
   IF INSTR("6789", MID$(pr$, 5, 1)) = 0 THEN good = 0
   FOR i = 3 TO 4
     IF INSTR("012345", MID$(pr$, i, 1)) = 0 THEN good = 0
   NEXT
   IF p1 < 1000 OR p1 > 9999 THEN good = 0
   IF p2 < 100 OR p2 > 999 THEN good = 0
   IF p3 < 100 OR p3 > 999 THEN good = 0
   IF good THEN
     pr1$ = LTRIM$(STR$(p1))
     pr2$ = LTRIM$(STR$(p2))
     pr3$ = LTRIM$(STR$(p3))
     big$ = MID$(pr3$, 1, 1) + MID$(pr3$, 3, 1) + MID$(pr1$, 4, 1)
     smal$ = MID$(pr1$, 1, 3) + pr2$ + MID$(pr3$, 2, 1)
     FOR i = 1 TO LEN(big$)
      IF INSTR("6789", MID$(big$, i, 1)) = 0 THEN good = 0
     NEXT
     FOR i = 1 TO LEN(smal$)
      IF INSTR("012345", MID$(smal$, i, 1)) = 0 THEN good = 0
     NEXT
     IF good THEN
       PRINT abc: PRINT m2
       PRINT p1: PRINT p2: PRINT p3
       PRINT pr$
       PRINT
       ct = ct + 1
     END IF
   END IF
  END IF

NEXT
NEXT
NEXT
NEXT
NEXT
NEXT
PRINT ct

finds (with formatting added by hand):

  173
  216
----- 
 1038
 173
346
----- 
37368
  177
  418
----- 
 1416
 177
708
----- 
73986
  177
  438
----- 
 1416
 531
708
----- 
77526
  353
  214
----- 
 1412
 353
706
----- 
75542
 4 solutions for part 1
  177
  437
----- 
 1239
 531
708
----- 
77349
  177
  438
----- 
 1416
 531
708
----- 
77526
 2 solutions for part 2


 
The digit 9 appears in the second solution for part 1 and the first solution for part 2. That leaves three solutions for part 1 and a unique solution for part 2 avoiding the digit 9.


  Posted by Charlie on 2011-06-09 13:59:52
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 (2)
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