Search NKS | Online
1 - 10 of 11 for OddQ
But if the number is odd, then first add 1—so as to get an even number—and only then multiply by 3/2 .
… The digit is 0 when the number is even and 1 when it is odd, and, as shown, the digits alternate in a seemingly random way. … The system here can be represented by the rule n If[EvenQ[n], 3n/2, 3(n + 1)/2] , while the one on page 100 follows the rule n If[EvenQ[n], 3n/2, (3n + 1)/2] .
Reconstructing initial conditions [in the 3n+1 problems]
Given a particular starting value of n , it is difficult to predict what precise sequence of even and odd values will be obtained in the system on page 123 . But given t steps in this sequence as a list of 0's and 1's, the following function will reconstruct the rightmost t digits in the starting value of n :
IntegerDigits[First[Fold[{Mod[If[OddQ[#2], 2 First[#1] - 1, 2 First[#1] PowerMod[5, -1, Last[#1]]], Last[#1]], 2 Last[#1]} &, {0, 2}, Reverse[list]]], 2, Length[list]]
Some of these numbers are even, while some are odd. But as the results at the bottom of the facing page illustrate, the sequence of which numbers are even and which are odd seems to be completely random.
… Indeed, even after a million steps, when the
Results of applying the rule n If[EvenQ[n], 5n/2, (n + 1)/2] , starting with different initial choices of n .
Whether any odd perfect numbers exist is probably the single oldest unsolved problem in mathematics. … Looking at curve (b) on page 135 , however, it does not seem inconceivable that an odd perfect number could exist. … Various generalizations of perfect numbers have been considered, requiring for example IntegerQ[DivisorSigma[1, n]/n] (pluperfect) or Abs[DivisorSigma[1, n] - 2n] < r (quasiperfect).
The state z = 1 evolves after one step to the state z = 1 + x , and for odd n this latter state always eventually appears again. … And now the repetition period for odd n divides
q[n]=2^MultiplicativeOrder[2, n, {1,-1}] - 1
The exponent here always lies between Log[k, n] and (n-1)/2 , with the upper bound being attained only if n is prime. Unlike for the case of rule 60, the period is usually equal to q[n] (and is assumed so for the picture on page 260 ), with the first exception occurring at n=37 .
Pascal's triangle and rule 90
As shown on page 611 the pattern produced by rule 90 is exactly Pascal's triangle of binomial coefficients reduced modulo 2: black cells correspond to odd binomial coefficients.
… The positions of the black cells are given by (and this establishes the connection with the picture on page 117 )
Fold[Flatten[{#1 - #2, #1 + #2}] &, {0}, 2^DigitPositions[t]]
DigitPositions[n_] := Flatten[Position[Reverse[IntegerDigits[n, 2]], 1]] - 1
The actual pattern generated by rule 90 corresponds to the coefficients in PolynomialMod[Expand[(1/x + x) t ], 2] (see page 1091 ); the color of a particular cell is thus given by Mod[Binomial[t, (n + t)/2], 2] /; EvenQ[n + t] .
… In this pattern, the color of a particular cell can be obtained directly from the digit sequences for t and n by 1 - Sign[BitAnd[-t, n]] or (see page 583 )
With[{d = Ceiling[Log[2, Max[t, n] + 1]]}, If[FreeQ[ IntegerDigits[t, 2, d] - IntegerDigits[n, 2, d], -1], 1, 0]]
(a) (Successive digits sequence) The sequence produced is repetitive, with the element at position n being black for n odd and white for n even. … These colors satisfy s[n_] := If[EvenQ[n], 1 - s[n/2], s[(n + 1)/2]] with s[1] = 1 . … (d) (Cantor set) The color of the element at position n is given by If[FreeQ[IntegerDigits[n - 1, 3], 1], 1, 0] , which turns out to be equivalent to
If[OddQ[n], Sign[Mod[Binomial[n - 1, (n - 1)/2], 3]], 0, 1]
There are 3 t elements after t steps, of which 2 t are black.
The 3n+1 problem
The system described here is similar to the so-called 3n+1 problem, in which one looks at the rule n If[EvenQ[n], n/2, (3n + 1)/2] and asks whether for any initial value of n the system eventually evolves to 1 (and thereafter simply repeats the sequence 1, 2, 1, 2, ...). … An alternative formulation is to ask whether for all n
FixedPoint[(3#/2^IntegerExponent[#, 2] + 1)/2 &, n] 2
With the rule n If[EvenQ[n], 5n/2, (n + 1)/2] used in the main text, the sequence produced repeats if n ever reaches 2, 4 or 40 (and possibly higher numbers). … To get some idea about the origin of this behavior, one can assume that successive values of n are randomly even and odd with equal probability.
(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]]
.
• (i) All strings containing an odd number of black elements are produced; a string of length n with m black cells occurs at step n + m - 1 .
• (j) All strings that end with a black element are produced.
• (k) Above length 1, the strings produced are exactly those starting with a white element. … takes 14 steps.
• (q) All strings are produced, with a string of length n with m white elements taking n + 2m steps.
• (r) All strings are ultimately produced—which is inevitable after the lemmas and appear at steps 12 and 13.