This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A209615 #55 Feb 26 2025 08:50:43 %S A209615 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, %T A209615 -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, %U A209615 -1,1,1,-1,-1,-1,1,1,-1,1,1,-1,-1,1,1,1,-1,-1,1,-1 %N A209615 Completely multiplicative with a(p^e) = 1 if p == 1 (mod 4), a(p^e) = (-1)^e otherwise. %C A209615 Turn sequence of the alternate paperfolding curve. Davis and Knuth define the alternate paperfolding curve by folding a long strip of paper repeatedly in half alternately to the left side or right side, then unfolding it so each crease is 90 degrees (or other angle). a(n) is their d(n) at equation 4.2. Their equation 6.2 (varied to d(2) = -1 as described there) is equivalent to the definition here. The curve is drawn by a unit step forward, turn a(1)*90 degrees left, a unit step forward, turn a(2)*90 degrees left, and so on. - _Kevin Ryde_, Apr 18 2020 %D A209615 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, CSLI Publications, 2010, pages 571-614. %H A209615 Jianing Song, <a href="/A209615/b209615.txt">Table of n, a(n) for n = 1..10000</a> %H A209615 Chandler Davis and Donald E. Knuth, <a href="/A005811/a005811.pdf">Number Representations and Dragon Curves</a>, Journal of Recreational Mathematics, volume 3, number 2, April 1970, pages 66-81, and number 3, July 1970, pages 133-149. [Cached copy, with permission] %H A209615 Kevin Ryde, <a href="http://user42.tuxfamily.org/alternate/index.html">Iterations of the Alternate Paperfolding Curve</a>, section "Turn". %H A209615 <a href="/index/Di#divseq">Index to divisibility sequences</a> %F A209615 G.f.: Sum_{k>=0} (-1)^k * x^(2^k) / (1 + x^(2^(k+1))). %F A209615 G.f. A(x) satisfies A(x) + A(x^2) = x / (1 + x^2). %F A209615 G.f. A(x) satisfies 0 = f(A(x), A(x^2), A(x^4)) where f(u, v, w) = (v + w) - (u + v)^2 * (1 + 2*(v + w)). %F A209615 If p is prime then a(p) = 1 if and only if p is in A002144. %F A209615 a(4*n + 1) = 1, a(4*n + 3) = -1. a(2*n) = a(3*n) = a(-n) = -a(n). %F A209615 a(n) = -(-1)^A106665(n-1) unless n=0. %F A209615 a(2n) = -a(n), a(2n+1) = (-1)^n. [Davis and Knuth equation 4.2] - _Kevin Ryde_, Apr 18 2020 %F A209615 From _Jianing Song_, Apr 24 2021: (Start) %F A209615 a(n) = 1 <=> A003324(n) = 1 or 4, a(n) = -1 <=> A003324(n) = 2 or 3. In other words, a(n) = Legendre(A003324(n), 5) == A003324(n)^2 (mod 5). %F A209615 a(n) = A034947(n) * (-1)^(v2(n)), where v2(n) = A007814(n) is the 2-adic valuation of n. %F A209615 Dirichlet g.f.: beta(s)/(1 + 2^(-s)). (End) %e A209615 G.f. = x - x^2 - x^3 + x^4 + x^5 + x^6 - x^7 - x^8 + x^9 - x^10 - x^11 - x^12 + ... %e A209615 From _Kevin Ryde_, Apr 18 2020: (Start) %e A209615 ... alternate %e A209615 | -1 paperfolding %e A209615 -1 --->\ \<--- +1 curve %e A209615 ^ -1 | ^ %e A209615 | v | turns +1 left %e A209615 start --> +1 +1 ---> +1 or -1 right %e A209615 (End) %t A209615 A209615[n_] := JacobiSymbol[-1, n]*(-1)^IntegerExponent[n, 2]; %t A209615 Array[A209615, 100] (* _Paolo Xausa_, Feb 26 2025 *) %o A209615 (PARI) {a(n) = my(v); if( n==0, 0, v = valuation( n, 2); (-1)^(n/2^v\2 + v))}; %o A209615 (PARI) {a(n) = if( n!=0, -kronecker( -1, n) * (-1)^if( n!=0, 1 - valuation( n, 2) %2))}; %o A209615 (PARI) {a(n) = my(A, p, e, f); sign(n) * if( n==0, 0, A = factor(abs(n)); prod( k=1, matsize(A)[1], [p, e] = A[k, ]; (-1)^(e * (p%4 != 1))) )}; %o A209615 (Python) %o A209615 def A209615(n): return -1 if ((n>>(m:=(~n&n-1).bit_length()))+1>>1)+m&1^1 else 1 # _Chai Wah Wu_, Feb 25 2025 %Y A209615 Cf. A002144, A003324, A034947, A106665, A292077. %Y A209615 Indices of 1: A338692 = A016813 U A343501; indices of -1: A338691 = A004767 U A343500. %Y A209615 Inverse Moebius transform gives A338690. %K A209615 sign,easy,mult %O A209615 1,1 %A A209615 _Michael Somos_, Mar 10 2012