# Search NKS | Online

1 - 10 of 50 for NestWhile

This is similar to picture (c) on page 131 , and is a digit-by-digit version of
FoldList[Plus, 0, Table[Apply[Plus, 2 Rest[IntegerDigits[i, 2]] - 1], {i, n}]]
Note that although the picture above has a nested structure, the original concatenation sequences are not nested, and so cannot be generated by substitution systems. The element at position n in the first sequence discussed above can however be obtained in about Log[n] steps using
((IntegerDigits[#3 + Quotient[#1, #2], 2] 〚 Mod[#1, #2] + 1 〛 &)[n - (# - 2)2 # - 1 - 2, #, 2 # - 1 ]&)[NestWhile[# + 1&, 0, (# - 1)2 # + 1 < n &]]
where the result of the NestWhile can be expressed as
Ceiling[1 + ProductLog[1/2(n - 1)Log[2]]/Log[2]]
Following work by Maxim Rytin in the late 1990s about k n+1 digits of a concatenation sequence can be found fairly efficiently from
k/(k - 1) 2 - (k - 1) Sum[k (k s - 1) ((1 + s - s k)/(k - 1)) (1/((k - 1) (k s - 1) 2 ) - k/((k - 1) (k s + 1 - 1) 2 ) + 1/(k s + 1 - 1)), {s, n}]
Concatenation sequences can also be generated by joining together digits from other representations of numbers; the picture below shows results for the Gray code representation from page 901 .

So if we listen to nested sequences, for example, we have no direct way to tell that they are nested, and indeed all we seem sensitive to are some rather simple features of the spectrum of frequencies that occur.
… The diversity of these spectra is quite striking: some have simple nested forms dominated by a few isolated peaks at specific frequencies, while others have quite complex forms that cover large ranges of frequencies.
Frequency spectra of nested sequences generated by one-dimensional neighbor-independent substitution systems.

rules 0 and 128 all the cells become white, while in rule 255 all of them become black. … The most common of these are nested patterns, like those on the next page . … But as the pictures on the next page show, other nested forms are also possible.

Note that the pattern in case (a) does eventually repeat, while the one in case (b) eventually shows a nested structure.

In the first kind of object, the actual sequence is then given, while in the second kind of object what is given is a specification of how far back in the data the required sequence can be found.
… Purely nested data can also be compressed nearly as much. … Examples of the pattern of repeats found in purely nested data.

Based on this
LE[list_] := Module[{n = Length[list], i = Max[MapIndexed[ #1 - #2 &, PrimePi[list]]] + 1}, CRT[PadRight[ list, n + i], Join[Array[Prime[i + #] &, n], Array[Prime, i]]]]
will yield a number x that can be decoded into a list of length n using essentially the so-called Gödel β function
Mod[x, Prime[Rest[NestList[NestWhile[# + 1 &, # + 1, Mod[x, Prime[#]] 0 &] &, 0, n]]]]

With rule (a), however, it is fairly easy to see that a simple nested structure is produced, directly analogous to the one shown on page 509 . … And the behavior obtained never seems to repeat, nor do the networks produced exhibit any kind of obvious nested form.
… It takes fewer steps for networks to be built up, but the results are qualitatively similar to those on the previous page : rule (a) yields a nested structure, rule (b) gives repetitive behavior, while rule (c) produces behavior that seems complicated and in some respects random.

But while some of these give behavior that looks slightly more complicated in detail, as in cases (a) and (b) on the next page , all ultimately turn out to yield just repetitive or nested patterns—at least if they are started with all cells white.
… Repetitive and nested patterns are seen, but nothing more complicated ever occurs.

With 3 states and 2 colors it turns out that with blank initial conditions all of the 2,985,984 possible Turing machines of this type quickly evolve to produce simple repetitive or nested behavior. With more complicated initial conditions the behavior one sees can sometimes be more complicated, at least for a while—as in the pictures below. … So this means
Examples of 3-state 2-color Turing machines which behave for a while in slightly complicated ways.

Other integer functions
IntegerExponent[n, k] gives nested behavior as for decimation systems on page 909 , while MultiplicativeOrder[k, n] and EulerPhi[n] yield more complicated behavior, as shown on pages 257 and 1093 .