# Search NKS | Online

1 - 10 of 34 for Floor

The vertical distance moved at the n th horizontal position is Floor[n h] - Floor[(n - 1) h] , and the sequence obtained from this (which contains only terms Floor[h] and Floor[h] + 1 ) provides a unique representation for h .

Assuming b > a > 0 , the number of zeros from the second family which appear between the n th and (n + 1) th zero from the first family is
(Floor[(n + 1) #] - Floor[n #] &)[(b - a)/(a + b)]
and as discussed on page 903 this sequence can be obtained by applying a sequence of substitution rules. For Sin[a x] + Sin[b x] a more complicated sequence of substitution rules yields the analogous sequence in which -1/2 is inserted in each Floor .

Properties [of example Turing machines]
The maximum numbers of steps increase with input size according to:
(a) 14 2^Floor[n/2] - 11 + 2Mod[n, 2]
(b) (does not halt for x = 1 )
(c) 2 n - 1
(d) (7(1 + Mod[n, 2])4^Floor[n/2] + 2Mod[n, 2] - 7)/3
(h) (see note below)
(i) (does not halt for various x > 53 )
(j) (does not halt for various x > 39 )
(k) (does not halt for x = 1 )
(l) 5 (2 n - 2 - 1)

Lengths of [number] representations
(a) n , (b) Floor[Log[2, n] + 1] , (c) Tr[FixedPointList[Max[0, Ceiling[Log[2, #]]] &, n + 2]] - n - 3 , (d) 2 Ceiling[Log[3, 2n + 1]] , (e) Floor[Log[GoldenRatio, √ 5 (n + 1/2)]] .

Implementation of digit sequences
A whole number n can be converted to a sequence of digits in base k using IntegerDigits[n,k] or (see also page 1094 )
Reverse[Mod[NestWhileList[Floor[#/k] &, n, # ≥ k &], k]]
and from a sequence of digits using FromDigits[list,k] or
Fold[k #1 + #2 &, 0, list]
For a number x between 0 and 1, the first m digits in its digit sequence in base k are given by RealDigits[x, k, m] or
Floor[k NestList[Mod[k #, 1]&, x, m - 1]]
and from these digits one can reconstruct an approximation to the number using FromDigits[{list, 0}, k] or
Fold[#1/k + #2 &, 0, Reverse[list]]/k

Relation [of powers] to substitution systems
Despite the uniform distribution result in the note above, the sequence Floor[(n + 1) h] - Floor[n h] is definitely not completely random, and can in fact be generated by a sequence of substitution rules. The first m rules (which yield far more than m elements of the original sequence) are obtained for any h that is not a rational number from the continued fraction form (see page 914 ) of h by
Map[(({0 Join[#, {1}], 1 Join[#, {1, 0}]} &)[Table[0, {# - 1}]]) &, Reverse[Rest[ContinuedFraction[h, m]]]]
Given these rules, the original sequence is given by
Floor[h] + Fold[Flatten[#1 /. #2] &, {0}, rules]
If h is the solution to a quadratic equation, then the continued fraction form is repetitive, and so there are a limited number of different substitution rules.

Much like example (c) on page 83 there are m + 1 distinct blocks of length m , and with f = Floor[(1 - 1/ √ 2 )(# + 1/ √ 2 )] & the n th element of the sequence is given by f[n + 1] - f[n] (see page 903 ).
… (f) The number of elements at step t is Round[(1 + √ 2 ) t /2] , and the n th element is given by Floor[ √ 2 (n + 1)] - Floor[ √ 2 n] (see page 903 ).

EvenQ] := Partition[ Fold[Insert[#1, #2, Random[Integer, Length[#1]] + 1] &, {}, Floor[Range[1, n + 2/3, 1/3]]], 2]
Networks obtained in this way are usually connected, but will almost always contain self-loops and multiple edges.

Starting with an ordinary base 2 digit sequence, one prepends a unary specification of its length, then a specification of that length specification, and so on:
(Flatten[{Sign[-Range[1 - Length[#], 0]], #}] &)[ Map[Rest, IntegerDigits[Rest[Reverse[NestWhileList[ Floor[Log[2, #] &, n + 1, # > 1 &]]],2]]]
(d) Binary-coded base 3. … Flatten[IntegerDigits[ Append[2 - With[{w = Floor[Log[3, 2n]]}, IntegerDigits[n - (3 w + 1 - 1)/2, 3, w]], 3], 2, 2]]
(e) Fibonacci encoding.

The number with run lengths corresponding to successive integers (so that the n th digit is Mod[Floor[1/2 + Sqrt[2n]], 2] ) turns out to be (1 - 2 1/4 EllipticTheta[2, 0, 1/2] + EllipticTheta[3, 0, 1/2])/2 , and appears at least not to be algebraic.