cp's OEIS Frontend

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.

A099545 Odd part of n, modulo 4.

This page as a plain text file.
%I A099545 #32 Feb 26 2025 08:48:48
%S A099545 1,1,3,1,1,3,3,1,1,1,3,3,1,3,3,1,1,1,3,1,1,3,3,3,1,1,3,3,1,3,3,1,1,1,
%T A099545 3,1,1,3,3,1,1,1,3,3,1,3,3,3,1,1,3,1,1,3,3,3,1,1,3,3,1,3,3,1,1,1,3,1,
%U A099545 1,3,3,1,1,1,3,3,1,3,3,1,1,1,3,1,1,3,3,3,1,1,3,3,1,3,3,3,1,1,3,1,1,3
%N A099545 Odd part of n, modulo 4.
%C A099545 The terms of this sequence are the even-indexed terms of A112658. - _Alexandre Wajnberg_, Jan 02 2006
%C A099545 Fractal sequence: odd terms are 1, 3, 1, 3,...; the even terms are the sequence itself: a(n)=a(2n)=a(4n)=a(8n)=a(16n)=... - _Alexandre Wajnberg_, Jan 02 2006
%C A099545 From _Micah D. Tillman_, Jan 29 2021: (Start)
%C A099545 Has the same structure as the regular paper-folding (dragon curve) sequence (A014577, A014709). We can interpret a(n) as the number of 90-degree rotations to make in a single direction at the n-th "turn" in the dragon curve. After all, making three 90-degree rotations to the left (turning a total of 270 degrees) is equivalent to making one 90-degree rotation to the right, and vice versa.
%C A099545 We can likewise produce the dragon curve by interpreting A000265(n), the whole odd part of n, as the number of 90-degree rotations to make in a single direction at the n-th "turn" in the curve. (End)
%H A099545 Michael De Vlieger, <a href="/A099545/b099545.txt">Table of n, a(n) for n = 1..10000</a>
%F A099545 a(n) = 2 * A038189(n) + 1.
%F A099545 (a(n)-1)/2 = A014707(n). - _Alexandre Wajnberg_, Jan 02 2006
%F A099545 a(n) = A010873(A000265(n)).
%F A099545 Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 2. - _Amiram Eldar_, Aug 29 2024
%e A099545 a(100) = 1: the odd part of 100 is 100/4 = 25, and 25 mod 4 = 1.
%t A099545 Array[Mod[#/(2^IntegerExponent[#, 2]), 4] &, 105] (* _Michael De Vlieger_, Feb 24 2021 *)
%o A099545 (PARI) a(n)=bitand(n/(2^valuation(n,2)), 3); /* _Joerg Arndt_, Jul 18 2012 */
%o A099545 (Python)
%o A099545 def A099545(n): return n>>(~n&n-1).bit_length()&3 # _Chai Wah Wu_, Feb 26 2025
%Y A099545 Cf. A010873, A000265, A014707, A038189.
%Y A099545 Cf. A099544, A099546, A099547, A099548, A099549, A099550, A099551.
%K A099545 nonn,easy
%O A099545 1,3
%A A099545 _Ralf Stephan_, Oct 23 2004