1
$\begingroup$

Suppose we have a string that occupies a length of seven characters, and the number of strings altogether is ten. We include the hamming distance of three characters. If we calculate the exact amount of all possible characters in the string besides the permutations in hamming.

We get a set of 970 characters. We divide 970 by the hamming distance which is three. We get about 107 possible permutations of characters that can be generated in a list of ten strings. In other words, 97 groupings of the same 10 should uniquely have 107 possible permutations within the 970 characters. (For the center numerical listed string based on hamming?)

If the algorithm is, correct (or I've misled). The center of 970 is at the 323rd string which should be the 107th permutation.

L=7 characters

X=10 strings

D=3 hamming distance

Z = X * X * 1 * L + X * D * D * D=970

S=323 possible permuations within hamming distance of 3

B=107th permutation within 323 possible permuations. (center)

Y=3

NOTE: The concept is to visualize our strings as a number line.

Here the algorithm is written in basic.

    0 A=1
    1 INPUT "LENGTH OF STRING";L
    2 INPUT "X FOR HOW MANY";X
    3 INPUT "D FOR HAMMING DISTANCE";D
    4 Z = X * X * 1 * L + X * D * D * D
    5 S = Z / D
    6 B = S / D
    7 Y = S / B
    8 CL = D * A ≤ X ≤ B * Y
    10 P=B*Y
    11 PRINT "CLOSEST STRING", CL, "P=", P
    12 IF S = S * D / D THEN PRINT"S = S * D / D", S * D / D
    13 IF D = Z / S THEN PRINT"D = Z / S", Z / S
    15 PRINT"PROOF", P, S

I also continue with the algorithm to find where the 2nd closest string, 3rd closest, 4th and so on.

    16 PRINT"WOULD YOU LIKE TO FIND CUSTOM CLOSEST STRING?";R$
    17 IF R$=YES$ THEN GOTO 19
    18 IF R$=NO$ THEN GOTO 19
    19 INPUT "ENTER # FOR CLSE STRING";RT
    20 GOTO 21
    21 PRINT"YOUR CLOSEST STRING"RT, S / RT
    90 NQ = S / RT
    91 P = RT * NQ
    92 IF P = NC THEN PRINT P, NC, "LUCKY"
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.