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

Home > Numbers
Palindromic and Tautonymic IV (Posted on 2010-12-27) Difficulty: 4 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.

(A+B)C + (D+E)F + (G+H)I

Determine the smallest and the largest positive palindromes. What are the smallest and the largest prime number? How many amongst the abovementioned list are tautonymic numbers?

See The Solution Submitted by K Sengupta    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution Comment 1 of 1

   10   LgPal=0:LgTau=0:LgPr=0
   20   SmPal=9999999999999999999999999
   30   SmTau=9999999999999999999999999
   40   SmPr=9999999999999999999999999
  110   V$="123456789":H$=V$
  115   repeat
  120     gosub *Permute(&V$)
  130     A=val(mid(V$,1,1))
  140     B=val(mid(V$,2,1))
  150     C=val(mid(V$,3,1))
  160     D=val(mid(V$,4,1))
  170     E=val(mid(V$,5,1))
  180     F=val(mid(V$,6,1))
  190     G=val(mid(V$,7,1))
  200     H=val(mid(V$,8,1))
  210     I=val(mid(V$,9,1))
  220     V=(A+B)^C+(D+E)^F+(G+H)^I
  230     S=cutspc(str(V))
  240     Pal=1
  250     for J=1 to int(len(S)/2)
  260       if mid(S,J,1)<>mid(S,len(S)+1-J,1) then Pal=0
  270     next
  280     if Pal=1 and V>LgPal then LgPal=V:LgPalS=V$
  290     if Pal=1 and V<SmPal then SmPal=V:SmPalS=V$
  300     if prmdiv(V)=V or prmdiv(V)=0 then Pr=1:else Pr=0
  310     if Pr=1 and V>LgPr then LgPr=V:LgPrS=V$
  320     if Pr=1 and V<SmPr then SmPr=V:SmPrS=V$
  330     if len(S) @ 2=0 then Tau=1:else Tau=0
  331     Diff=0
  332     for J=2 to len(S)
  333      if mid(S,J,1)<>mid(S,1,1) then Diff=1
  334     next
  335     if Diff=0 then Tau=0
  340     for J=1 to int(len(S)/2)
  350       if mid(S,J,1)<>mid(S,int(len(S)/2)+J,1) then Tau=0
  360     next
  370     if Tau=1 and V>LgTau then LgTau=V:LgTauS=V$
  380     if Tau=1 and V<SmTau then SmTau=V:SmTauS=V$
  700   until V$=H$
  710   print "("+mid(SmPalS,1,1)+"+"+mid(SmPalS,2,1)+")^"+mid(SmPalS,3,1)+"+("+mid(SmPalS,4,1)+"+"+mid(SmPalS,5,1)+")^"+mid(SmPalS,6,1)+"+("+mid(SmPalS,7,1)+"+"+mid(SmPalS,8,1)+")^"+mid(SmPalS,9,1),SmPal
  720    print "("+mid(LgPalS,1,1)+"+"+mid(LgPalS,2,1)+")^"+mid(LgPalS,3,1)+"+("+mid(LgPalS,4,1)+"+"+mid(LgPalS,5,1)+")^"+mid(LgPalS,6,1)+"+("+mid(LgPalS,7,1)+"+"+mid(LgPalS,8,1)+")^"+mid(LgPalS,9,1),LgPal
  730   print "("+mid(SmPrS,1,1)+"+"+mid(SmPrS,2,1)+")^"+mid(SmPrS,3,1)+"+("+mid(SmPrS,4,1)+"+"+mid(SmPrS,5,1)+")^"+mid(SmPrS,6,1)+"+("+mid(SmPrS,7,1)+"+"+mid(SmPrS,8,1)+")^"+mid(SmPrS,9,1),SmPr
  740    print "("+mid(LgPrS,1,1)+"+"+mid(LgPrS,2,1)+")^"+mid(LgPrS,3,1)+"+("+mid(LgPrS,4,1)+"+"+mid(LgPrS,5,1)+")^"+mid(LgPrS,6,1)+"+("+mid(LgPrS,7,1)+"+"+mid(LgPrS,8,1)+")^"+mid(LgPrS,9,1),LgPr
  750   print "("+mid(SmTauS,1,1)+"+"+mid(SmTauS,2,1)+")^"+mid(SmTauS,3,1)+"+("+mid(SmTauS,4,1)+"+"+mid(SmTauS,5,1)+")^"+mid(SmTauS,6,1)+"+("+mid(SmTauS,7,1)+"+"+mid(SmTauS,8,1)+")^"+mid(SmTauS,9,1),SmTau
  760    print "("+mid(LgTauS,1,1)+"+"+mid(LgTauS,2,1)+")^"+mid(LgTauS,3,1)+"+("+mid(LgTauS,4,1)+"+"+mid(LgTauS,5,1)+")^"+mid(LgTauS,6,1)+"+("+mid(LgTauS,7,1)+"+"+mid(LgTauS,8,1)+")^"+mid(LgTauS,9,1),LgTau
  790   end

 

finds

 

Palindromic
(4+5)^3+(6+9)^1+(7+8)^2 = 969
(1+3)^9+(2+5)^8+(6+7)^4 = 6055506

Prime
(4+5)^3+(6+8)^2+(7+9)^1 = 941
(1+4)^2+(3+6)^5+(7+8)^9 = 38443418449

Tautonymic
(4+7)^3+(5+8)^2+(6+9)^1 = 1515
(4+7)^3+(5+8)^2+(6+9)^1 = 1515

(apparently there's only one tautonym, serving as both smallest and largest)


  Posted by Charlie on 2010-12-27 16:35:06
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 (19)
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