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

Home > General > Word Problems
X-pandigital Words (Posted on 2012-11-07) Difficulty: 2 of 5
Let us define an x-pandigital word, where A=1,B=2,C=3, etc., as an English word such that the concatenated digits 0 to x of the positional letter-values are used exactly once. In order for a word to be a true x-pandigital word all digits between 0 and x, and only digits 0 to x, must be used exactly once.
What are the shortest and longest x-pandigital words*?

A zeroless x-pandigital word is a word with the same constraints as an x-pandigital word, but excludes the digit 0. What are the shortest and longest zeroless x-pandigital words?

*More than one possible word may exist for both shortest and longest. The length of an x-pandigital word can be less or equal to length x. As such, an x-pandigital word that uses more digits is considered longer for words otherwise of the same length.
You may provide as many x-pandigital words you find, even those that are neither the smallest or largest. An example of an x-pandigital word where x=5 is CENT {C=3, E=5, N=14, T=20}. The concatenated value of CENT is 351420, composed of the digits (not numbers) 0 thru 5.

See The Solution Submitted by Dej Mar    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re(2): computer solutions -- revised complete lists Comment 3 of 3 |
(In reply to re: computer solutions by Dej Mar)

Here's the revised list, where each digit appears only once in each numeric value:

(sequence of each line is x, word length, number length, word and numeric value)

2  2  3 at 120
2  2  3 ta 201
3  3  4 act 1320
3  3  4 cat 3120
5  4  6 cent 351420
5  5  6 acted 132054
5  5  6 cadet 314520
9  8 10 fetching 6520389147

1  1  1 a 1
2  2  2 ab 12
2  2  2 ba 21
3  2  3 aw 123
3  3  3 cab 312
4  3  4 cud 3214
4  3  4 daw 4123
4  3  4 wad 2314
5  3  5 cox 31524
5  3  5 dow 41523
5  3  5 new 14523
5  3  5 wen 23514
5  4  5 awed 12354
5  4  5 cued 32154
5  4  5 duce 42135
5  4  5 wade 23145

revised first program (second program--no zeros--similar):

OPEN "\words\words.txt" FOR INPUT AS #1
OPEN "xpandigw.txt" FOR OUTPUT AS #2
DO
    INPUT #1, w$
    good = 1: n$ = ""
    FOR i = 1 TO LEN(w$)
      p = INSTR("abcdefghijklmnopqrstuvwxyz", MID$(w$, i, 1))
      IF p = 0 THEN good = 0: EXIT FOR
      n$ = n$ + LTRIM$(STR$(p))
    NEXT
    IF good THEN
       REDIM used(9)
       FOR i = 1 TO LEN(n$)
         used(VAL(MID$(n$, i, 1))) = used(VAL(MID$(n$, i, 1))) + 1
         IF used(VAL(MID$(n$, i, 1))) > 1 THEN good = 0
       NEXT
       IF used(0) = 0 THEN good = 0
       flag = 1
       FOR i = 0 TO 9
          IF used(i) = 0 THEN flag = 0
          IF used(i) = 1 AND flag = 0 THEN good = 0: EXIT FOR
       NEXT
       IF good THEN
          x = 9
          FOR i = 0 TO 9
            IF used(i) = 0 THEN x = i - 1: EXIT FOR
          NEXT
          PRINT w$, x
          PRINT #2, USING "# ## ## & &"; x; LEN(w$); LEN(n$); w$; n$
          IF LEN(w$) > LEN(longest$) THEN
            longlen = LEN(w$)
            longxval = x
            longest$ = w$
            ln$ = n$
          END IF
       END IF
    END IF
LOOP UNTIL EOF(1)
PRINT
PRINT longest$, longlen, longxval, ln$
CLOSE

 


  Posted by Charlie on 2012-11-08 09:52:23
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 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information