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

Home > Just Math
A digital arrangement (Posted on 2005-06-30) Difficulty: 3 of 5
Without using any arithmetical symbols (+, -, *, /, or similar; other math symbols; decimal comma or periods; letters; even parentheses) or, in short, anything but the digits, build a number with the digits 1, 3, 5, 7 and 9, that is equal to a number built with the digits 2, 4, 6 and 8 (each digit used once and only once).

Note: This is not a trick. It was extracted from a book edited by Angela Dunn, a mathematician who gathered problems that appeared in many scientific periodical revues!

See The Solution Submitted by pcbouhid    
Rating: 3.2857 (7 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
re: A solution and question | Comment 2 of 21 |
(In reply to A solution and question by owl)

1579 3        26 48
1957 3        682 4
5179 3        26 84
7915 3        426 8
9157 3        42 68
9175 3        426 8
9715 3        842 6

from

DECLARE FUNCTION conv! (s$, b!)
DECLARE SUB permute (a$)
CLS
a$ = "13579"
b$ = "2468"
FOR i = 1 TO 120
FOR bd1 = 1 TO 3
 n1$ = LEFT$(a$, 5 - bd1): b1 = VAL(RIGHT$(a$, bd1))
 n1 = conv(n1$, b1)
 FOR j = 1 TO 24
 FOR bd2 = 1 TO 2
   n2$ = LEFT$(b$, 4 - bd2): b2 = VAL(RIGHT$(b$, bd2))
   n2 = conv(n2$, b2)
   IF n1 = n2 THEN
     PRINT n1$; b1, n2$; b2
   END IF
 NEXT
 permute b$
 NEXT
NEXT
permute a$
NEXT

FUNCTION conv (s$, b)
 t = 0
 FOR i = 1 TO LEN(s$)
  t = t * b + VAL(MID$(s$, i, 1))
 NEXT
 conv = t
END FUNCTION

SUB permute (a$)
DEFINT A-Z
 x$ = ""
 FOR i = LEN(a$) TO 1 STEP -1
  l$ = x$
  x$ = MID$(a$, i, 1)
  IF x$ < l$ THEN EXIT FOR
 NEXT


 IF i = 0 THEN
  FOR j = 1 TO LEN(a$) \ 2
   x$ = MID$(a$, j, 1)
   MID$(a$, j, 1) = MID$(a$, LEN(a$) - j + 1, 1)
   MID$(a$, LEN(a$) - j + 1, 1) = x$
  NEXT
 ELSE
  FOR j = LEN(a$) TO i + 1 STEP -1
   IF MID$(a$, j, 1) > x$ THEN EXIT FOR
  NEXT
  MID$(a$, i, 1) = MID$(a$, j, 1)
  MID$(a$, j, 1) = x$
  FOR j = 1 TO (LEN(a$) - i) \ 2
   x$ = MID$(a$, i + j, 1)
   MID$(a$, i + j, 1) = MID$(a$, LEN(a$) - j + 1, 1)
   MID$(a$, LEN(a$) - j + 1, 1) = x$
  NEXT
 END IF
END SUB

 


  Posted by Charlie on 2005-06-30 20:40:36
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (1)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (17)
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