# Search NKS | Online

61 - 70 of 115 for IntegerDigits

Implementation [of conserved quantity test]
Whether a k -color cellular automaton with range r conserves total cell value can be determined from
Catch[Do[ (If[Apply[Plus, CAStep[rule, #] - #] ≠ 0, Throw[False]] &)[ IntegerDigits[i, k, m]], {m, w}, {i, 0, k m - 1}]; True]
where w can be taken to be k 2r , and perhaps smaller.

After t steps, this method yields a result accurate to about t 2 digits.
… This method yields about 2.5 t base 2 digits after t steps.
… Note that the method works not only for integers, but for any rational number n for which 1 ≤ n < 4 .

Sierpiński pattern
Other ways to generate step n of the pattern shown here in various orientations include:
• Mod[Array[Binomial, {2, 2} n , 0], 2]
(see pages 611 and 870 )
• 1 - Sign[Array[BitAnd, {2, 2} n , 0]]
(see pages 608 and 871 )
• NestList[Mod[RotateLeft[#] + #, 2] &, PadLeft[{1}, 2 n ], 2 n - 1]
(see page 870 )
• NestList[Mod[ListConvolve[{1, 1}, #, -1], 2] &, PadLeft[{1}, 2 n ], 2 n - 1]
(see page 870 )
• IntegerDigits[NestList[BitXor[2#, #] &, 1, 2 n - 1], 2, 2 n ]
(see page 906 )
• NestList[Mod[Rest[FoldList[Plus, 0, #]], 2] &, Table[1, {2 n }], 2 n - 1]
(see page 1034 )
• Table[PadRight[ Mod[CoefficientList[(1 + x) t - 1 , x], 2], 2 n - 1], {t, 2 n }]
(see pages 870 and 951 )
• Reverse[Mod[CoefficientList[Series[1/(1 - (1 + x)y), {x, 0, 2 n - 1}, {y, 0, 2 n - 1}], {x, y}], 2]]
(see page 1091 )
• Nest[Apply[Join, MapThread[ Join, {{#, #}, {0 #, #}}, 2]] &, {{1}}, n]
(compare page 1073 )
The positions of black squares can be found from:
• Nest[Flatten[2# /. … (OddQ[Length[#]] &), {2}]
(see page 358 )
• Flatten[Table[Map[{t, #} &, Fold[Flatten[{#1, #1 + #2}] &, 0, Flatten[2^(Position[ Reverse[IntegerDigits[t, 2]], 1] - 1)]]], {t, 2 n - 1}], 1]
(see page 870 )
• Map[Map[FromDigits[#, 2] &, Transpose[Partition[#, 2]]] &, Position[Nest[{{#, #}, {#}} &, 1, n], 1] - 1]
(see page 509 )
A formatting hack giving the same visual pattern is
DisplayForm[Nest[SubsuperscriptBox[#, #, #] &, "1", n]]

[Examples of] short computations
Some properties include:
(a) The regions are bounded by the hyperbolas x y Exp[n/2] for successive integers n .
… (h) Mod[Quotient[s, 2 n ], 2] extracts the digit associated with 2 n in the base 2 digit sequence of s .

Digit sequence properties
Empirical evidence for the randomness of the digit sequences of √ n , π , etc. has been accumulating since early computer experiments in the 1940s. … A number is said to be "normal" in a particular base if every digit and every block of digits of any length occur with equal frequency. … An example of this is the number 0.1234567891011121314... obtained by concatenating the digits of successive integers in base 10 (see below ).

The method based on IntegerDigits in the previous two notes can be improved (notably by power tree methods), but apparently about Log[t] steps are always needed.

In case (c), the following gives a list of the numbers of nodes generated up to step t :
FoldList[Plus, 1, Join[{1, 4, 12, 10, -20, 6, 4}, Map[d, IntegerDigits[Range[4, t - 5], 2]]]]
d[{___, 1}] = 1
d[{1, p : 0 .., 0}] := -Apply[Plus, 4 Range[Length[{p}]] - 1] + 6
d[{__, 1, p : 0 .., 0}] := d[{1, p, 0}] - 7
d[{___, p : 1 .., q : 0 ..., 1, 0}] := 4 Length[{p}] + 3 Length[{q}] + 2
d[{___, p : 1 .., 1, 0}] := 4 Length[{p}] + 2

The next integer after all of the ordinary ones—the first infinite integer—is given the name ω . … In general there are many different expressions that correspond to a given number, though there is always a unique Cantor normal form—essentially a finite sequence of digits giving coefficients of descending powers of ω . However, not all infinite integers can be represented in this way.

Note that the total number of integers less than n which can be expressed as a sum of three squares increases roughly like 5n/6 , with fluctuations related to IntegerDigits[n, 4] . … The total number of ways that integers less than n can be expressed as a sum of d squares is equal to the number of integer lattice points that lie inside a sphere of radius Sqrt[n] in d -dimensional space. … Hardy and John Littlewood in 1922 to be proportional to
2n Apply[Times, Map[(# - 1)/(# - 2)&, Map[First, Rest[FactorInteger[n]]]]]/Log[n] 2
It was proved in 1937 by Ivan Vinogradov that any large odd integer can be expressed as a sum of three primes.

If the elements of list correspond to values of a polynomial of degree n at successive integers, then Nest[d, list, n + 1] will contain only zeros. … The pictures below show the results with k = 2 (rule 60) for (a) Fibonacci[n] , (b) Thue–Morse sequence, (c) Fibonacci substitution system, (d) (Prime[n] - 1)/2 , (e) digits of π .