OFFSET
0,6
COMMENTS
For n >= 1, a(n) gives the distance of n in square array A191450 from its leftmost column.
The sequence 0,1,0,0,0,2,0,...,i.e., (a(n)) with the first term removed, is the unique fixed point of the constant length 3 morphism N -> 0 N+1 0 on the infinite alphabet {0,1,...,N,...}. - Michel Dekking, Sep 09 2022
a(n) is the number of trailing 1 digits of n-1 written in ternary, for n>=1. - Kevin Ryde, Sep 09 2022
LINKS
Antti Karttunen, Table of n, a(n) for n = 0..10000
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
MATHEMATICA
With[{nmax=200}, IntegerExponent[2Range[0, nmax]-1, 3]] (* Paolo Xausa, Nov 09 2023 *)
PROG
(Scheme, with memoization-macro definec)
(PARI) a(n) = n--; my(ret=0, r); while([n, r]=divrem(n, 3); r==1, ret++); ret; \\ Kevin Ryde, Sep 13 2022
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Antti Karttunen, Jan 22 2015
STATUS
approved