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

 X-pandigital Words (Posted on 2012-11-07)
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.)
 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 1202  2  3 ta 2013  3  4 act 13203  3  4 cat 31205  4  6 cent 3514205  5  6 acted 1320545  5  6 cadet 3145209  8 10 fetching 6520389147`
`1  1  1 a 12  2  2 ab 122  2  2 ba 213  2  3 aw 1233  3  3 cab 3124  3  4 cud 32144  3  4 daw 41234  3  4 wad 23145  3  5 cox 315245  3  5 dow 415235  3  5 new 145235  3  5 wen 235145  4  5 awed 123545  4  5 cued 321545  4  5 duce 421355  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

 Search: Search body:
Forums (0)