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.

A122587 Leading digit of n in base 4.

This page as a plain text file.
%I A122587 #14 Jan 30 2023 10:59:46
%S A122587 1,2,3,1,1,1,1,2,2,2,2,3,3,3,3,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,2,2,
%T A122587 2,2,2,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,1,1,1,1,
%U A122587 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
%N A122587 Leading digit of n in base 4.
%C A122587 Digits 1, 2 and 3 appear cyclically and each time in runs whose lengths are the powers of 4.
%F A122587 a(n) = floor(n/(4^floor(log[4](n)))).
%e A122587 a(1) = 1/(4^0) = 1.
%p A122587 seq( evalf(floor(n/ (4^floor(log[4](n))))), n=1..500);
%t A122587 Table[First[IntegerDigits[n, 4]], {n, 100}] (* _Alonso del Arte_, Sep 30 2011 *)
%o A122587 (Python)
%o A122587 def A122587(n): return int(bin(n)[2:3+(n.bit_length()&1^1)],2) # _Chai Wah Wu_, Jan 30 2023
%K A122587 easy,nonn,base
%O A122587 1,2
%A A122587 Peter C. Heinig (algorithms(AT)gmx.de), Oct 20 2006