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

Home > Numbers
Palindromic and Tautonymic (Posted on 2009-03-03) Difficulty: 2 of 5
Make a list of distinct positive integers that are obtained by assigning a different decimal digit from 1 to 9 to each of the capital letters in bold in this expression.

                           (AB)/C + (DE)/F + (GH)/I

How many of these integers are palindromes? How many are tautonymic numbers?

Note:
A tautonymic number is one which can be divided into two equal non-palindromic halves, with each part having at least two different digits. For example, each of 3636, 5252, 6767, 276276 and 56635663 is a tautonymic number - but, none of 4444 and 555555 is a tautonymic number.

See The Solution Submitted by K Sengupta    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 5 |
1^5 / 2 + 3^7 / 6 + 4^9 / 8 = 33133       palindrome
2^5 / 1 + 3^7 / 9 + 4^6 / 8 = 787         palindrome
2^5 / 4 + 3^8 / 1 + 6^7 / 9 = 37673       palindrome
2^5 / 8 + 3^7 / 9 + 4^6 / 1 = 4343        tautonym
3^8 / 9 + 5^7 / 2 + 6^1 / 4 = 39793       palindrome
4^7 / 1 + 6^8 / 2 + 9^5 / 3 = 875875      tautonym
4^7 / 8 + 5^3 / 2 + 9^1 / 6 = 2112        palindrome
7^5 / 2 + 8^4 / 1 + 9^3 / 6 = 12621       palindrome

so there are 6 palindromes and 2 tautonymic numbers.

DECLARE SUB Permute (A$)
DEFDBL A-Z
PRINT
s$ = "123456789": hgs$ = s$
DO
  A = VAL(LEFT$(s$, 1)): D = VAL(MID$(s$, 4, 1)): G = VAL(MID$(s$, 7, 1))
  IF A < D AND D < G THEN
   B = VAL(MID$(s$, 2, 1)): E = VAL(MID$(s$, 5, 1)): H = VAL(MID$(s$, 8, 1))
   C = VAL(MID$(s$, 3, 1)): F = VAL(MID$(s$, 6, 1)): I = VAL(MID$(s$, 9, 1))
   v = (A ^ B) / C + (D ^ E) / F + (G ^ H) / I
   tst = ABS(INT(v) - v)
   IF tst > .9999999000000001# OR tst < .000001# THEN good = 1: ELSE good = 0
   IF good THEN
     v = INT(v + .5)
     st$ = LTRIM$(STR$(v))
     pal = 1
     FOR j = 1 TO INT(LEN(st$) / 2)
       IF MID$(st$, j, 1) <> MID$(st$, LEN(st$) + 1 - j, 1) THEN pal = 0: EXIT FOR
     NEXT
     IF LEN(st$) MOD 2 = 0 THEN Taut = 1:  ELSE Taut = 0
     Gap = INT(LEN(st$) / 2)
     FOR j = 1 TO INT(LEN(st$) / 2)
       IF MID$(st$, j, 1) <> MID$(st$, j + Gap, 1) THEN Taut = 0: EXIT FOR
     NEXT
     Taut2 = 0
     FOR j = 2 TO LEN(st$)
       IF MID$(st$, j, 1) <> LEFT$(st$, 1) THEN Taut2 = 1: EXIT FOR
     NEXT
     IF pal OR Taut AND Taut2 THEN
       PRINT MID$(s$, 1, 1); "^"; MID$(s$, 2, 1); " / "; MID$(s$, 3, 1); " + ";
       PRINT MID$(s$, 4, 1); "^"; MID$(s$, 5, 1); " / "; MID$(s$, 6, 1); " + ";
       PRINT MID$(s$, 7, 1); "^"; MID$(s$, 8, 1); " / "; MID$(s$, 9, 1);
       PRINT " = "; st$,
       IF pal THEN PRINT "palindrome":  ELSE PRINT "tautonym"
     END IF
   END IF
  END IF
   Permute s$
LOOP UNTIL hgs$ = s$
END


  Posted by Charlie on 2009-03-03 14:07:14
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