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

Home > Numbers
Pandigital Multiplication and Division (Posted on 2006-10-07) Difficulty: 3 of 5
Part 1.
Find a 5-digit integer that consists of five consecutive digits, not necessarily in numerical order, such that, when multiplied by 8, the product is a 5-digit number consisting of the other five digits.

Part 2.
Find a 5-digit integer that consists of five consecutive digits, not necessarily in numerical order, such that, when divided by 8, the quotient is a 5-digit number consisting of the other five digits.

  Submitted by Charlie    
Rating: 4.0000 (1 votes)
Solution: (Hide)
12345 * 8 = 98760
87456 / 8 = 10932

DECLARE SUB permute (a$)
dig$ = "0123456789"
FOR strt = 1 TO 6
  n$ = MID$(dig$, strt, 5)
  nh$ = n$
  DO
   IF LEFT$(n$, 1) <> "0" THEN
     n2$ = LTRIM$(STR$(8 * VAL(n$)))
     con$ = n$ + n2$
     IF LEN(con$) = 10 THEN
       good = 1
       FOR i = 1 TO 9
         IF INSTR(MID$(con$, i + 1), MID$(con$, i, 1)) THEN good = 0: EXIT FOR
       NEXT
       IF good THEN PRINT n$; " * 8 = "; n2$
     END IF
   END IF
   permute n$
  LOOP UNTIL n$ = nh$
NEXT
FOR strt = 1 TO 6
  n$ = MID$(dig$, strt, 5)
  nh$ = n$
  DO
   IF LEFT$(n$, 1) <> "0" AND VAL(n$) MOD 8 = 0 THEN
     n2$ = LTRIM$(STR$(VAL(n$) / 8))
     con$ = n$ + n2$
     IF LEN(con$) = 10 THEN
       good = 1
       FOR i = 1 TO 9
         IF INSTR(MID$(con$, i + 1), MID$(con$, i, 1)) THEN good = 0: EXIT FOR
       NEXT
       IF good THEN PRINT n$; " / 8 = "; n2$
     END IF
   END IF
   permute n$
  LOOP UNTIL n$ = nh$
NEXT

The permute subroutine is defined elsewhere on the site

From Enigma # 1408, New Scientist, 9 September 2006.

Comments: ( You must be logged in to post comments.)
  Subject Author Date
Puzzle Thoughts K Sengupta2023-06-22 01:48:42
Solutionsolutionsjessica2006-10-19 13:45:49
solution to part 1 and 2Chandra2006-10-08 17:25:48
SolutionSolution to part 2Joel2006-10-07 19:09:52
Some ThoughtsPart 2Larry2006-10-07 18:03:35
Duh! Read the problem!Steve Herman2006-10-07 09:38:12
re: This seems like one problem, not two (spoiler)Charlie2006-10-07 09:15:21
SolutionThis seems like one problem, not two (spoiler)Steve Herman2006-10-07 08:22:22
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