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 A081610 #18 Dec 05 2024 10:18:34 %S A081610 0,0,1,1,1,2,3,4,5,5,5,6,6,6,7,8,9,10,11,12,13,14,15,16,17,18,19,19, %T A081610 19,20,20,20,21,22,23,24,24,24,25,25,25,26,27,28,29,30,31,32,33,34,35, %U A081610 36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53 %N A081610 Number of numbers <= n having at least one 2 in their ternary representation. %C A081610 a(n) + A081611(n) = n+1. Partial sums of A189820. %H A081610 Nathaniel Johnston, <a href="/A081610/b081610.txt">Table of n, a(n) for n = 0..10000</a> %F A081610 a(n) ~ n. - _Charles R Greathouse IV_, Sep 02 2015 %p A081610 num2tern := proc(n) return numboccur(convert(n,base,3),2): end: a:=0: for n from 0 to 80 do a:=a+`if`(num2tern(n)>0,1,0): printf("%d, ",a): od: # _Nathaniel Johnston_, May 17 2011 %t A081610 Accumulate[Table[If[DigitCount[n,3,2]>0,1,0],{n,0,70}]] (* _Harvey P. Dale_, Aug 20 2012 *) %o A081610 (PARI) first(n)=my(s,t); vector(n,k,t=Set(digits(k,3)); s+=t[#t]==2) \\ _Charles R Greathouse IV_, Sep 02 2015 %o A081610 (Python) %o A081610 from gmpy2 import digits %o A081610 def A081610(n): %o A081610 l = (s:=digits(n,3)).find('2') %o A081610 if l >= 0: s = s[:l]+'1'*(len(s)-l) %o A081610 return n-int(s,2) # _Chai Wah Wu_, Dec 05 2024 %Y A081610 Cf. A007089, A081603, A081607, A081609, A189820. %K A081610 nonn,easy %O A081610 0,6 %A A081610 _Reinhard Zumkeller_, Mar 23 2003