Make a list of distinct positive integers that are obtained by assigning a different base ten digit from 1 to 9 to each of the capital letters in this expression.
(A-B)C + (C-D)E + (F-G)I
What are the respective minimum and maximum positive palindromes from amongst the elements that correspond to the foregoing list.
As a bonus, what are the respective minimum and maximum positive
tautonymic numbers that are included in the list? How about the respective maximum and minimum negative tautonymic numbers?
If 1 is considered a palindrome, then there are various ways of producing it, such as
(1-2)^3 + (3-4)^6 + (8-7)^9 = 1
and 3128 other ways.
If, however, you need at least a couple of digits then
(6-9)^2 + (2-1)^7 + (5-4)^3 = 11
as well as many other ways of producing 11.
But if you really need diversity of digits, then the ways of getting 101 are sufficiently few to list them all:
(5-1)^3 + (3-9)^2 + (6-7)^4 = 101
(6-4)^7 + (7-9)^5 + (8-3)^1 = 101
(8-5)^3 + (3-6)^4 + (2-9)^1 = 101
(9-8)^3 + (3-5)^6 + (1-7)^2 = 101
(9-8)^3 + (3-5)^6 + (7-1)^2 = 101
(3-8)^2 + (2-7)^1 + (9-6)^4 = 101
(3-8)^2 + (2-7)^1 + (6-9)^4 = 101
(6-9)^3 + (3-1)^8 + (2-4)^7 = 101
(8-2)^3 + (3-1)^7 + (6-9)^5 = 101
(1-9)^2 + (2-4)^6 + (5-8)^3 = 101
(8-7)^9 + (9-2)^3 + (1-4)^5 = 101
(9-8)^5 + (5-3)^6 + (1-7)^2 = 101
(9-8)^5 + (5-3)^6 + (7-1)^2 = 101
(4-2)^7 + (7-9)^5 + (8-3)^1 = 101
(5-1)^3 + (3-9)^2 + (7-6)^8 = 101
(5-1)^3 + (3-9)^2 + (7-6)^4 = 101
(5-1)^3 + (3-9)^2 + (7-8)^6 = 101
(2-4)^7 + (7-5)^8 + (6-9)^3 = 101
(5-1)^3 + (3-9)^2 + (7-8)^4 = 101
(7-6)^1 + (1-4)^5 + (9-2)^3 = 101
(5-1)^3 + (3-9)^2 + (8-7)^6 = 101
(9-1)^2 + (2-4)^6 + (5-8)^3 = 101
(8-1)^3 + (3-4)^2 + (6-9)^5 = 101
(8-1)^3 + (3-2)^9 + (4-7)^5 = 101
(5-1)^3 + (3-9)^2 + (8-7)^4 = 101
(8-1)^3 + (3-2)^7 + (6-9)^5 = 101
(6-9)^3 + (3-5)^7 + (2-4)^8 = 101
(8-1)^3 + (3-2)^6 + (4-7)^5 = 101
(7-1)^2 + (2-4)^6 + (9-8)^5 = 101
(7-1)^2 + (2-4)^6 + (9-8)^3 = 101
(8-1)^3 + (3-2)^4 + (6-9)^5 = 101
(9-2)^3 + (3-6)^5 + (7-8)^4 = 101
(9-5)^3 + (3-4)^6 + (1-7)^2 = 101
(9-2)^3 + (3-6)^5 + (8-7)^4 = 101
(9-2)^3 + (3-6)^5 + (8-7)^1 = 101
(4-2)^7 + (7-1)^3 + (6-9)^5 = 101
(6-9)^3 + (3-5)^7 + (4-2)^8 = 101
(9-6)^4 + (4-8)^2 + (7-3)^1 = 101
(9-5)^3 + (3-4)^6 + (7-1)^2 = 101
(9-5)^3 + (3-4)^8 + (1-7)^2 = 101
(9-5)^3 + (3-4)^8 + (7-1)^2 = 101
(8-4)^3 + (3-9)^2 + (6-5)^7 = 101
(8-4)^3 + (3-9)^2 + (6-5)^1 = 101
(6-9)^3 + (3-5)^8 + (2-4)^7 = 101
(8-3)^1 + (1-9)^2 + (6-4)^5 = 101
(8-4)^3 + (3-9)^2 + (7-6)^5 = 101
(8-4)^3 + (3-9)^2 + (7-6)^1 = 101
(4-7)^5 + (5-6)^8 + (9-2)^3 = 101
(4-7)^5 + (5-6)^2 + (8-1)^3 = 101
(7-9)^6 + (6-4)^5 + (8-3)^1 = 101
(2-5)^3 + (3-1)^8 + (4-6)^7 = 101
(5-6)^8 + (8-4)^3 + (7-1)^2 = 101
(8-7)^1 + (1-4)^5 + (9-2)^3 = 101
(4-7)^3 + (3-5)^6 + (9-1)^2 = 101
(5-6)^8 + (8-4)^3 + (1-7)^2 = 101
(1-4)^5 + (5-6)^8 + (9-2)^3 = 101
(8-3)^2 + (2-7)^1 + (6-9)^4 = 101
(4-7)^3 + (3-5)^6 + (1-9)^2 = 101
(6-8)^5 + (5-3)^7 + (9-4)^1 = 101
(9-8)^7 + (7-1)^2 + (3-5)^6 = 101
(9-8)^7 + (7-1)^2 + (5-3)^6 = 101
(9-3)^2 + (2-1)^4 + (5-7)^6 = 101
(9-3)^2 + (2-1)^4 + (7-5)^6 = 101
(9-3)^2 + (2-1)^8 + (5-7)^6 = 101
(9-3)^2 + (2-1)^8 + (7-5)^6 = 101
(6-9)^4 + (4-8)^2 + (7-3)^1 = 101
(8-3)^2 + (2-7)^1 + (9-6)^4 = 101
(3-6)^4 + (4-8)^2 + (9-5)^1 = 101
(7-3)^1 + (1-5)^2 + (6-9)^4 = 101
(3-9)^2 + (2-1)^4 + (5-7)^6 = 101
(9-7)^6 + (6-4)^5 + (8-3)^1 = 101
(1-7)^2 + (2-4)^6 + (9-8)^5 = 101
(4-6)^7 + (7-9)^8 + (2-5)^3 = 101
(6-5)^7 + (7-1)^2 + (8-4)^3 = 101
(1-7)^2 + (2-4)^6 + (9-8)^3 = 101
(7-3)^1 + (1-5)^2 + (9-6)^4 = 101
(3-9)^2 + (2-1)^4 + (7-5)^6 = 101
(3-9)^2 + (2-1)^8 + (5-7)^6 = 101
(3-9)^2 + (2-1)^8 + (7-5)^6 = 101
(9-3)^2 + (2-4)^6 + (8-7)^5 = 101
(9-3)^2 + (2-4)^6 + (8-7)^1 = 101
(3-9)^2 + (2-4)^6 + (8-7)^5 = 101
(9-4)^1 + (1-3)^5 + (8-6)^7 = 101
(4-2)^5 + (5-7)^6 + (8-3)^1 = 101
(3-9)^2 + (2-4)^6 + (8-7)^1 = 101
(6-3)^4 + (4-8)^2 + (9-5)^1 = 101
(9-8)^1 + (1-7)^2 + (5-3)^6 = 101
(9-8)^1 + (1-7)^2 + (3-5)^6 = 101
(7-6)^9 + (9-2)^3 + (1-4)^5 = 101
(6-5)^8 + (8-4)^3 + (7-1)^2 = 101
(6-9)^5 + (5-4)^7 + (8-1)^3 = 101
(6-5)^1 + (1-7)^2 + (8-4)^3 = 101
(6-5)^8 + (8-4)^3 + (1-7)^2 = 101
(5-1)^3 + (3-9)^2 + (6-7)^8 = 101
(6-9)^5 + (5-4)^2 + (8-1)^3 = 101
For the maximum, there's no doubt:
(4-6)^7 + (7-5)^1 + (2-9)^8 = 5764675
(4-6)^7 + (7-5)^1 + (9-2)^8 = 5764675
(6-4)^1 + (1-3)^7 + (2-9)^8 = 5764675
(2-9)^8 + (8-6)^1 + (3-5)^7 = 5764675
(6-4)^1 + (1-3)^7 + (9-2)^8 = 5764675
(4-5)^1 + (1-6)^3 + (9-2)^8 = 5764675
(4-5)^1 + (1-6)^3 + (2-9)^8 = 5764675
(9-2)^8 + (8-6)^1 + (3-5)^7 = 5764675
(1-6)^3 + (3-4)^5 + (2-9)^8 = 5764675
(4-5)^9 + (9-2)^8 + (1-6)^3 = 5764675
(1-6)^3 + (3-4)^7 + (9-2)^8 = 5764675
(1-6)^3 + (3-4)^7 + (2-9)^8 = 5764675
(1-6)^3 + (3-4)^5 + (9-2)^8 = 5764675
For the tautonyms, as defined, we need at least 4 digits, so 1010 wins the low spot (pun intended):
(9-4)^2 + (2-5)^6 + (3-1)^8 = 1010
(5-9)^4 + (4-7)^6 + (3-8)^2 = 1010
(5-9)^4 + (4-1)^6 + (8-3)^2 = 1010
(5-9)^4 + (4-1)^6 + (3-8)^2 = 1010
(5-1)^4 + (4-7)^6 + (8-3)^2 = 1010
(5-1)^4 + (4-7)^6 + (3-8)^2 = 1010
(7-5)^8 + (8-3)^2 + (1-4)^6 = 1010
(5-7)^8 + (8-3)^2 + (1-4)^6 = 1010
(3-7)^4 + (4-9)^2 + (5-8)^6 = 1010
(3-7)^4 + (4-9)^2 + (8-5)^6 = 1010
(4-9)^2 + (2-5)^6 + (3-1)^8 = 1010
(4-9)^2 + (2-5)^6 + (1-3)^8 = 1010
(9-5)^4 + (4-7)^6 + (8-3)^2 = 1010
(9-5)^4 + (4-7)^6 + (3-8)^2 = 1010
(4-7)^6 + (6-1)^2 + (5-3)^8 = 1010
(9-5)^4 + (4-1)^6 + (8-3)^2 = 1010
(1-5)^4 + (4-7)^6 + (8-3)^2 = 1010
(9-5)^4 + (4-1)^6 + (3-8)^2 = 1010
(7-3)^4 + (4-9)^2 + (5-8)^6 = 1010
(9-4)^2 + (2-5)^6 + (1-3)^8 = 1010
(7-5)^8 + (8-3)^2 + (4-1)^6 = 1010
(7-3)^4 + (4-9)^2 + (8-5)^6 = 1010
(8-5)^6 + (6-1)^2 + (3-7)^4 = 1010
(4-7)^6 + (6-1)^2 + (3-5)^8 = 1010
(8-5)^6 + (6-1)^2 + (7-3)^4 = 1010
(5-8)^6 + (6-1)^2 + (7-3)^4 = 1010
(5-8)^6 + (6-1)^2 + (3-7)^4 = 1010
(1-3)^8 + (8-5)^6 + (9-4)^2 = 1010
(7-9)^8 + (8-3)^2 + (1-4)^6 = 1010
(5-9)^4 + (4-7)^6 + (8-3)^2 = 1010
(7-4)^6 + (6-1)^2 + (3-5)^8 = 1010
(1-5)^4 + (4-7)^6 + (3-8)^2 = 1010
(9-7)^8 + (8-3)^2 + (4-1)^6 = 1010
(9-7)^8 + (8-3)^2 + (1-4)^6 = 1010
(3-1)^8 + (8-5)^6 + (4-9)^2 = 1010
(3-1)^8 + (8-5)^6 + (9-4)^2 = 1010
(7-4)^6 + (6-1)^2 + (5-3)^8 = 1010
(7-9)^8 + (8-3)^2 + (4-1)^6 = 1010
(1-3)^8 + (8-5)^6 + (4-9)^2 = 1010
(5-7)^8 + (8-3)^2 + (4-1)^6 = 1010
and the largest:
(4-2)^9 + (9-3)^5 + (8-1)^7 = 831831
(6-4)^9 + (9-3)^5 + (8-1)^7 = 831831
For palindromes:
5 kill "paltaut2.txt":open "paltaut2.txt" for output as #2
10 L="123456789":H=L
20 repeat
30 A=val(mid(L,1,1))
40 B=val(mid(L,2,1))
50 C=val(mid(L,3,1))
60 D=val(mid(L,4,1))
70 E=val(mid(L,5,1))
80 F=val(mid(L,6,1))
90 G=val(mid(L,7,1))
100 I=val(mid(L,9,1))
200 V=cutspc(str((A-B)^C+(C-D)^E+(F-G)^I))
210 V1=val(V)
220 if V1>0 then
230 :Good=1
240 :for I=1 to int(len(V)/2)
250 :if mid(V,I,1)<>mid(V,len(V)-I+1,1) then Good=0:endif
260 :next
270 :if Good then print #2,L,:print #2,using(17,0),V1
280 :print L,:print using(17,0),V1
930 gosub *Permute(&L)
950 until L=H
9999 end
For tautonyms:
5 kill "paltaut3.txt":open "paltaut3.txt" for output as #2
10 L="123456789":H=L
20 repeat
30 A=val(mid(L,1,1))
40 B=val(mid(L,2,1))
50 C=val(mid(L,3,1))
60 D=val(mid(L,4,1))
70 E=val(mid(L,5,1))
80 F=val(mid(L,6,1))
90 G=val(mid(L,7,1))
100 I=val(mid(L,9,1))
200 V=cutspc(str((A-B)^C+(C-D)^E+(F-G)^I))
210 V1=val(V)
220 if V1>0 and len(V)@2=0 then
230 :Good=1
240 :for I=1 to int(len(V)/2)
250 :if mid(V,I,1)<>mid(V,int(len(V)/2)+I,1) then Good=0:endif
260 :next
270 :if Good then print #2,L,:print #2,using(17,0),V1
280 :print L,:print using(17,0),V1
930 gosub *Permute(&L)
950 until L=H
9999 end
Reformatted (after sorting) by:
OPEN "paltaut2.txt" FOR INPUT AS #1
OPEN "paltau2.txt" FOR OUTPUT AS #2
DO
LINE INPUT #1, l$
a$ = MID$(l$, 1, 1)
b$ = MID$(l$, 2, 1)
c$ = MID$(l$, 3, 1)
d$ = MID$(l$, 4, 1)
e$ = MID$(l$, 5, 1)
f$ = MID$(l$, 6, 1)
g$ = MID$(l$, 7, 1)
h$ = MID$(l$, 8, 1)
i$ = MID$(l$, 9, 1)
PRINT #2, "("; a$; "-"; b$; ")^"; c$; " + ("; c$; "-"; d$; ")^"; e$; " + ("; f$; "-"; g$; ")^"; i$; " = "; LTRIM$(MID$(l$, 11))
LOOP UNTIL EOF(1)
CLOSE
|
Posted by Charlie
on 2009-12-20 16:31:54 |