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.
%I A215879 #39 Oct 15 2022 08:51:04 %S A215879 0,1,1,0,2,2,0,2,2,0,1,1,0,3,3,0,3,3,0,1,1,0,3,3,0,3,3,0,1,1,0,2,2,0, %T A215879 2,2,0,1,1,0,4,4,0,4,4,0,1,1,0,4,4,0,4,4,0,1,1,0,2,2,0,2,2,0,1,1,0,4, %U A215879 4,0,4,4,0,1,1,0,4,4,0,4,4,0,1,1,0,2,2,0,2,2,0,1,1,0,3,3,0,3,3,0,1,1,0,3,3,0,3 %N A215879 Written in base 3, n ends in a(n) consecutive nonzero digits. %C A215879 Somehow complementary to A007949, the 3-adic valuation of n. %C A215879 The base 2 analog of this sequence essentially coincides with the 2-adic valuation A007814 (up to a shift in the index). %C A215879 One gets back the same sequence by concatenation of the pattern (0,1,1) successively multiplied by a(n)+1 = 1, 2, 2, 1, 3, 3, ... for n = 0, 1, 2, 3, 4, 5, .... This is equivalent to the formula (a(n)+1)*(0, 1, 1) = a(3n, 3n+1, 3n+2). - _M. F. Hasler_, Aug 26 2012, corrected Aug 23 2022 %C A215879 a(A008585(n)) = 0; a(A001651(n)) > 0. - _Reinhard Zumkeller_, Dec 28 2012 %H A215879 Reinhard Zumkeller, <a href="/A215879/b215879.txt">Table of n, a(n) for n = 0..10000</a> %F A215879 a(3^(t+1)*k+m) = t for 3^t > m > 3^(t-1). %F A215879 a(3n) = 0, a(3n+1) = a(3n+2) = a(n)+1. - _M. F. Hasler_, Aug 26 2012, corrected thanks to a remark from _Jianing Song_, Aug 23 2022 %e A215879 The numbers 0, 1, 2, 3, 4, 5, 6, 7 are written in base 3 as 0, 1, 2, 10, 11, 12, 20, 21 and thus end in a(0..7) = 0, 1, 1, 0, 2, 2, 0, 2 nonzero digits. %t A215879 cnzd[n_]:=Module[{idn3=IntegerDigits[n,3],len},len=Length[idn3];Which[ idn3[[len]] == 0,0,Position[idn3,0]=={},len,True,len-Position[idn3,0] [[-1,1]]]]; Array[cnzd,110,0] (* _Harvey P. Dale_, Jun 07 2016 *) %o A215879 (PARI) A215879(n,b=3)=n=divrem(n,b); for(c=0,oo,n[2]||return(c); n=divrem(n[1],b)) %o A215879 (PARI) a(n)=my(k);while(n%3,n\=3;k++);k \\ _Charles R Greathouse IV_, Sep 26 2013 %o A215879 (Haskell) %o A215879 a215879 n = if t == 0 then 0 else a215879 n' + 1 %o A215879 where (n',t) = divMod n 3 %o A215879 -- _Reinhard Zumkeller_, Dec 28 2012 %o A215879 (Python) %o A215879 def A215879(n): %o A215879 c = 0 %o A215879 while (a:=divmod(n,3))[1]: %o A215879 c += 1 %o A215879 n = a[0] %o A215879 return c # _Chai Wah Wu_, Oct 15 2022 %Y A215879 The base-4, base-5 and base-10 analogs of this sequence are given in A215883, A215884 and A215887. %Y A215879 Cf. A007089. %K A215879 nonn,base,nice %O A215879 0,5 %A A215879 _M. F. Hasler_, Aug 25 2012