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

Home > Just Math
From Poland with love (Posted on 2012-12-13) Difficulty: 3 of 5
On my boring (No food, no TV) flight from Krakow to Paris I have created, solved and debugged the following alphametics:
POLSKA + KRAKOW = ANSWER.

Apparently there are 2 possible solutions.
a. (D2) Find both.

b. (D4) What is the maximum value of POLSKA + KRAKOW if the digits corresponding to the word POLSKA form a square number?

Rem : Each letter corresponds to a certain digit (distinct in each case) - other than that there are no restrictions.

No Solution Yet Submitted by Ady TZIDON    
No Rating

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

DECLARE SUB permute (a$)

CLS

a$ = "1234567890": h$ = a$
DO
  p = VAL(MID$(a$, 1, 1))
  o = VAL(MID$(a$, 2, 1))
  l = VAL(MID$(a$, 3, 1))
  s = VAL(MID$(a$, 4, 1))
  k = VAL(MID$(a$, 5, 1))
  a = VAL(MID$(a$, 6, 1))
  r = VAL(MID$(a$, 7, 1))
  w = VAL(MID$(a$, 8, 1))
  n = VAL(MID$(a$, 9, 1))
  e = VAL(MID$(a$, 10, 1))
  polska = VAL(LEFT$(a$, 6))
  krakow = 100100 * k + 10000 * r + 1000 * a + 10 * o + w
  answer = 100000 * a + 10000 * n + 1000 * s + 100 * w + 10 * e + r
  IF polska + krakow = answer THEN PRINT polska; krakow; answer
  permute a$
LOOP UNTIL a$ = h$
PRINT "paused"
PRINT : PRINT

DO: LOOP UNTIL INKEY$ > ""
part2:

a$ = "1234567890": h$ = a$
DO
  p = VAL(MID$(a$, 1, 1))
  o = VAL(MID$(a$, 2, 1))
  l = VAL(MID$(a$, 3, 1))
  s = VAL(MID$(a$, 4, 1))
  k = VAL(MID$(a$, 5, 1))
  a = VAL(MID$(a$, 6, 1))
  r = VAL(MID$(a$, 7, 1))
  w = VAL(MID$(a$, 8, 1))
  n = VAL(MID$(a$, 9, 1))
  e = VAL(MID$(a$, 10, 1))
  polska = VAL(LEFT$(a$, 6))
  sr = INT(SQR(polska) + .5)
  IF sr * sr = polska THEN
    krakow = 100100 * k + 10000 * r + 1000 * a + 10 * o + w
    sum = polska + krakow
    IF sum >= max THEN
      PRINT polska, krakow, sum
      max = sum
    END IF
  END IF
  permute a$
LOOP UNTIL a$ = h$

finds

polska  krakow  answer
489516  136187  625703
675318  128174  803492

and the final, largest line for part b is

polska        krakow
760384   +    894865   =    1655249

  Posted by Charlie on 2012-12-13 15:48:57
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 (22)
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