login
A081610
Number of numbers <= n having at least one 2 in their ternary representation.
8
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, 19, 20, 20, 20, 21, 22, 23, 24, 24, 24, 25, 25, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53
OFFSET
0,6
COMMENTS
a(n) + A081611(n) = n+1. Partial sums of A189820.
LINKS
FORMULA
a(n) ~ n. - Charles R Greathouse IV, Sep 02 2015
MAPLE
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
MATHEMATICA
Accumulate[Table[If[DigitCount[n, 3, 2]>0, 1, 0], {n, 0, 70}]] (* Harvey P. Dale, Aug 20 2012 *)
PROG
(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
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Mar 23 2003
STATUS
approved