The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A309873 Period-doubling turn sequence, +1 when the 2-adic valuation of n is even or -1 when odd. 1
 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, 1, 1, -1, 1, -1, 1, -1 (list; graph; refs; listen; history; text; internal format)
 OFFSET 1 COMMENTS a(n)=+1 when the number of low 0 bits of n is even, and a(n)=-1 when odd.  This is the "period doubling" sequence A096268 but using +1,-1.  See A096268 and its complement A035263 for more.  The number of low 0 bits of n is A007814.  a(n) is completely multiplicative since A007814(n*m) = A007814(n) + A007814(m). a(n) is among some completely multiplicative +1,-1 sequences considered by Davis and Knuth for forming curves by unfolding.  a(n) is their d(n) at equation 6.4.  The curve can be drawn by successively going forward a unit step and turning by a(n)*angle.  Their "bending" angle T is equivalent to turns by 180-T degrees.  They draw bending angle 90 degrees which is merely 4 unit squares repeatedly traversed; and bending 60 degrees "Fido" and 120 degrees which are bigger and more interesting.  Partial sums A068639 are the directions (net total turn) of the segments. REFERENCES Chandler Davis and Donald E. Knuth, Number Representations and Dragon Curves -- I and II, Journal of Recreational Mathematics, volume 3, number 2, April 1970, pages 66-81, and number 3, July 1970, pages 133-149.  Reprinted in Donald E. Knuth, Selected Papers on Fun and Games, 2010, pages 571-614. LINKS Sample Images (and LaTeX source) FORMULA a(n) = (-1)^A007814(n) = -(-1)^A065882(n) = 1 - 2*A096268(n-1) = 2*A035263(n) - 1 = A035263(n) - A096268(n-1). a(n) = A068639(n) - A068639(n-1). a(A003159) = 1, a(A036554) = -1. For prime p, a(p) = -1 if p=2 (even), a(p) = 1 if p odd [Davis and Knuth, which together with completely multiplicative defines a(n)]. MATHEMATICA Array[(-1)^IntegerExponent[#, 2] &, 100] (* Amiram Eldar, Aug 22 2019 *) PROG (PARI) a(n) = (-1)^valuation(n, 2); (UCB Logo) ; a(n), and draw "Fido" of Davis and Knuth to a :n   output 2*(remainder (bitxor :n :n-1) 3) - 1 end setheading 90  ; start East repeat 4095 [ forward 7  ; pixels               left (a repcount) * 120 ]  ; or try 60 or 90 CROSSREFS Cf. A096268, A035263, A003159, A036554, A007814. Partial sums A068639. Sequence in context: A000012 A216430 A232544 * A162511 A157895 A063747 Adjacent sequences:  A309870 A309871 A309872 * A309874 A309875 A309876 KEYWORD mult,sign,easy AUTHOR Kevin Ryde, Aug 21 2019 STATUS approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified April 19 22:40 EDT 2021. Contains 343117 sequences. (Running on oeis4.)