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.

A235127 Greatest k such that 4^k divides n.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1
Offset: 1

Views

Author

Tom Edgar, Jan 03 2014

Keywords

Examples

			Since 4^2 divides 32 and 4^3 does not, we have a(32) = 2. Likewise, since no positive power of 4 divides 9, a(9) = 0.
		

Crossrefs

Programs

  • Mathematica
    IntegerExponent[Range@ 105, 4] (* Michael De Vlieger, Nov 18 2017 *)
  • PARI
    A235127(n) = valuation(n,4); \\ Antti Karttunen, Nov 18 2017
    
  • Python
    def A235127(n): return (~n&n-1).bit_length()>>1 # Chai Wah Wu, Jul 08 2022
  • Sage
    n=100 #change n for more terms
    [valuation(i,4) for i in [1..n]]
    

Formula

a(n) = valuation(n,4).
G.f.: Sum_{k>=1} x^(4^k)/(1 - x^(4^k)). - Ilya Gutkovskiy, Jan 28 2017
a(n) = A004526(A007814(n)). - Antti Karttunen, Nov 18 2017
Asymptotic mean: lim_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1/3. - Amiram Eldar, Jan 17 2022

Extensions

More terms from Antti Karttunen, Nov 18 2017