A253786 a(3n) = 0, a(3n+1) = 0, a(3n+2) = 1 + a(n+1).
0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 4, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 3, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 2, 0, 0, 1, 0, 0, 1, 0, 0, 5
Offset: 0
Links
- Antti Karttunen, Table of n, a(n) for n = 0..10000
Crossrefs
Programs
-
Mathematica
With[{nmax=200},IntegerExponent[2Range[0,nmax]-1,3]] (* Paolo Xausa, Nov 09 2023 *)
-
PARI
a(n) = n--; my(ret=0,r); while([n,r]=divrem(n,3); r==1, ret++); ret; \\ Kevin Ryde, Sep 13 2022
Formula
Other identities and observations. For all n >= 1:
a(n) = A254046(n)-1.
a(3n-1) = A254046(n). - Cyril Damamme, Aug 04 2015
a(n) = A007949(2n-1), i.e., the 3-adic valuation of 2n-1. - Cyril Damamme, Aug 04 2015
From Antti Karttunen, Sep 12 2017: (Start)
For all n >= 1:
Asymptotic mean: Limit_{m->oo} (1/m) * Sum_{k=1..m} a(k) = 1/2. - Amiram Eldar, Nov 16 2023
Comments