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

Home > General
No way to win (Posted on 2014-04-17) Difficulty: 4 of 5
My alphametic
NOWAY*TOWIN=<PRODUCT>
exists in two versions (both with a unique solution):

a. Both words for a "PRODUCT" contain the letter D, one in the begining, the other at the word's end.
b. One has 9 letters the other 10, not all of them distinct.

You are requested to find both products.

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 for one of the two | Comment 1 of 4

DEFDBL A-Z
DIM used(9) AS STRING
OPEN "nowaywin.txt" FOR OUTPUT AS #2
FOR n = 1 TO 9
  used(n) = "n"
  FOR t = 1 TO 9
    IF used(t) = "" THEN
      used(t) = "t"
      FOR o = 0 TO 9
        IF used(o) = "" THEN
          used(o) = "o"
          FOR w = 0 TO 9
            IF used(w) = "" THEN
              LOCATE ofst + 1, 1
              PRINT n; t; o; w; "   ";

              used(w) = "w"
              FOR a = 0 TO 9
                IF used(a) = "" THEN
                  used(a) = "a"
                  FOR y = 0 TO 9
                    IF used(y) = "" THEN
                      used(y) = "y"
                      noway = 10000 * n + 1000 * o + 100 * w + 10 * a + y
                      FOR i = 0 TO 9
                        IF used(i) = "" THEN
                          used(i) = "i"

                          towin = 10000 * t + 1000 * o + 100 * w + 10 * i + n
                          product = noway * towin
                          ps$ = LTRIM$(STR$(product))
                          pro$ = ps$
                          ln = LEN(ps$)
                          FOR psn = 1 TO ln
                            IF used(VAL(MID$(ps$, psn, 1))) > "" THEN
                              MID$(ps$, psn, 1) = used(VAL(MID$(ps$, psn, 1)))
                            ELSE
                              MID$(ps$, psn, 1) = "*"
                            END IF
                          NEXT
                          OPEN "\words\words" + LTRIM$(STR$(ln)) + ".txt" FOR BINARY AS #10
                          wrd$ = SPACE$(ln)
                          DO
                            GET #10, , wrd$
                            good = 1
                            IF EOF(10) THEN EXIT DO
                            IF LEFT$(wrd$, 1) = "d" OR RIGHT$(wrd$, 1) = "d" THEN
                              FOR psn = 1 TO ln
                                IF MID$(wrd$, psn, 1) <> MID$(ps$, psn, 1) AND MID$(ps$, psn, 1) <> "*" THEN good = 0: EXIT FOR
                                IF INSTR("nowayti", MID$(wrd$, psn, 1)) > 0 AND MID$(ps$, psn, 1) = "*" THEN good = 0: EXIT FOR
                              NEXT
                              IF good THEN
                                extr$ = ""
                                FOR psn = 1 TO ln
                                  IF INSTR("nowayti", MID$(wrd$, psn, 1)) = 0 THEN
                                    dval = VAL(MID$(pro$, psn, 1))
                                    IF used(dval) = "" THEN
                                      IF INSTR(extr$, MID$(wrd$, psn, 1)) > 0 THEN good = 0: EXIT FOR
                                      extr$ = extr$ + MID$(wrd$, psn, 1)
                                      used(dval) = MID$(wrd$, psn, 1)
                                    ELSE
                                      IF used(dval) <> MID$(wrd$, psn, 1) THEN good = 0: EXIT FOR
                                    END IF
                                  END IF
                                NEXT
                                IF good THEN
                                  PRINT wrd$ + " " + STR$(noway) + STR$(towin) + STR$(product) + CHR$(13) + CHR$(10)
                                  PRINT #2, wrd$ + " " + STR$(noway) + STR$(towin) + STR$(product) + CHR$(13) + CHR$(10)
                                  ofst = ofst + 1
                                END IF
                                FOR dgt = 0 TO 9
                                  IF used(dgt) > "" THEN
                                    IF INSTR("nowayti", used(dgt)) = 0 THEN used(dgt) = ""
                                  END IF
                                NEXT
                              END IF
                            END IF
                          LOOP UNTIL EOF(10)
                          CLOSE 10

                          used(i) = ""
                        END IF
                      NEXT
                      used(y) = ""
                    END IF
                  NEXT
                  used(a) = ""
                END IF
              NEXT
              used(w) = ""
            END IF
          NEXT
          used(o) = ""
        END IF
      NEXT
      used(t) = ""
    END IF
  NEXT
  used(n) = ""
NEXT
CLOSE

has been running about 4 hours now, after having been debugged, and has so far found one of the answers:

                       <product>
sainthood  53842 13865 746519330
     NOWAY TOWIN SAINTHOOD

By tomorrow morning I expect it will have found the other.




  Posted by Charlie on 2014-04-19 01:13:13
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 (24)
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