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.

A077267 Number of zeros in base-3 expansion of n.

This page as a plain text file.
%I A077267 #33 Feb 16 2025 08:32:48
%S A077267 1,0,0,1,0,0,1,0,0,2,1,1,1,0,0,1,0,0,2,1,1,1,0,0,1,0,0,3,2,2,2,1,1,2,
%T A077267 1,1,2,1,1,1,0,0,1,0,0,2,1,1,1,0,0,1,0,0,3,2,2,2,1,1,2,1,1,2,1,1,1,0,
%U A077267 0,1,0,0,2,1,1,1,0,0,1,0,0,4,3,3,3,2,2,3,2,2,3,2,2,2,1,1,2,1,1,3,2,2,2,1,1,2
%N A077267 Number of zeros in base-3 expansion of n.
%H A077267 Reinhard Zumkeller, <a href="/A077267/b077267.txt">Table of n, a(n) for n = 0..10000</a>
%H A077267 F. T. Adams-Watters, F. Ruskey, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL12/Ruskey2/ruskey14.html">Generating Functions for the Digital Sum and Other Digit Counting Sequences</a>, JIS 12 (2009) 09.5.6
%H A077267 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/Ternary.html">Ternary</a>.
%H A077267 Wikipedia, <a href="http://en.wikipedia.org/wiki/Ternary_numeral_system">Ternary numeral system</a>
%F A077267 a(1)=a(2)=0; a(3n)=a(n)+1; a(3n+1)=a(3n+2)=a(n). a(3^n-2)=a(3^n-1)=0; a(3^n)=n. a(n)=A077266(n, 3).
%F A077267 a(n) + A062756(n) + A081603(n) = A081604(n). - _Reinhard Zumkeller_, Mar 23 2003
%F A077267 G.f.: (Sum_{k>=0} x^(3^(k+1))/(1 + x^(3^k) + x^(2*3^k)))/(1-x). - _Franklin T. Adams-Watters_, Nov 03 2005
%F A077267 a(n) = A079978(n) if n < 3, A079978(n) + a(floor(n/3)) otherwise. - _Reinhard Zumkeller_, Feb 21 2013
%e A077267 a(8)=0 since 8 written in base 3 is 22 with 0 zeros;
%e A077267 a(9)=2 since 9 written in base 3 is 100 with 2 zeros;
%e A077267 a(10)=1 since 10 written in base 3 is 101 with 1 zero.
%t A077267 Table[Count[IntegerDigits[n,3],0],{n,0,6!}] (* _Vladimir Joseph Stephan Orlovsky_, Jul 25 2009 *)
%t A077267 DigitCount[Range[0,110],3,0] (* _Harvey P. Dale_, Jul 04 2021 *)
%o A077267 (Haskell)
%o A077267 a077267 n = a079978 n + if n < 3 then 0 else a077267 (n `div` 3)
%o A077267 -- _Reinhard Zumkeller_, Feb 21 2013
%Y A077267 Cf. A023416, A077266, A062756, A081603.
%Y A077267 Cf. A007089, A081605, A032924, A081607, A081608, A077267, A134023. - _Reinhard Zumkeller_, Mar 23 2003
%K A077267 base,nonn
%O A077267 0,10
%A A077267 _Henry Bottomley_, Nov 01 2002
%E A077267 a(0)=1 added, offset changed to 0 and b-file adjusted by _Reinhard Zumkeller_, Feb 21 2013
%E A077267 Wrong formula deleted by _Reinhard Zumkeller_, Feb 21 2013