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

Home > Numbers
Mirror, Mirror on the wall (Posted on 2004-07-15) Difficulty: 3 of 5
Find the lowest positive integer that has its digits reversed after dividing it by 2.

See The Solution Submitted by SilverKnight    
Rating: 2.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts computer | Comment 4 of 9 |

The following program does not find anything:

DECLARE FUNCTION verify! (a$, b$)
FOR n = 1 TO 999999
  n$ = LTRIM$(STR$(n))
  IF verify(n$, "01258") = 0 THEN
   h$ = ""
   FOR j = 1 TO LEN(n$)
    d$ = MID$(n$, j, 1)
    IF d$ = "5" THEN d$ = "2":  ELSE IF d$ = "2" THEN d$ = "5"
    h$ = d$ + h$
   NEXT
   h = VAL(h$)
   IF 2 * h = n THEN PRINT n
  END IF
NEXT

FUNCTION verify (a$, b$)
 FOR i = 1 TO LEN(a$)
  IF INSTR(b$, MID$(a$, i, 1)) = 0 THEN verify = i: EXIT FUNCTION
 NEXT
 verify = 0
END FUNCTION

 


  Posted by Charlie on 2004-07-15 11:18:31
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