# Complete NP: What approach is best for a problem such as the nearest chain?

A new summary of the conceptual approach of the nearest chain would be appreciated. Especially to clear up the confusion, I will provide a link to a written computer script with the linear approach in mind.

Wikipedia Nearest chain

Example of a basic script

NOTE: The concept is to visualize the chains as a number line.

Script stripped

L = length of the string in number of characters

X = how many ropes in total.

D = hamming distance.

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

S = Z / D

B = S / D

Y = S / B

P = B * Y
``````

The algorithm takes input for the length of a string to L, and the number of strings in total for X. The hamming distance is for the entrance. re. Entry Z calculates the exact amount of all possible characters in the string plus the permutations for the input re.

We get a set of Z number of characters. We divide Z by re which S. We obtain second Possible permutations of characters that can be generated in a list of X string instruments. In other words, Z divided by Y groupings of the same X must have only B possible permutations within the Z characters. (For the numerical chain of the center based on Hamming?)

If the algorithm is, correct (or I've cheated). The center of Z it's in the S chain that should be the second permutation.

The verification of mathematics.

S = S * D / D

D = Z / S

Continue if I want to find the second closest, the third closest and so on within the amount S that was swapped within the distance of Hamming.

``````NQ = S / RT

P = RT * NQ
``````

My understanding of the nearest chain is wrong when it comes to the linear approach, why is the approach not promising? In what way would you approach it?

TO UPDATE-
EXAMPLE
The number line starts from 485.5 and ends in 971. To find our nearest number 15 string, we go to

NQ = S / RT
P = RT * NQ

The result of NQ is added to 485.5 and we obtain our nearest 15th chain.

Let's suppose, we have a habit. Fifth chain closest to our primary S what's it gonna be NQ. We divide NQ continues adding the sum of them 5 D until an approximate Z. If it is not equal to Z then divide NQ for 2 Will this check the algorithm?