OFFSET
0,6
LINKS
Nathaniel Johnston, Table of n, a(n) for n = 0..10000
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
(Python)
from gmpy2 import digits
def A081610(n):
l = (s:=digits(n, 3)).find('2')
if l >= 0: s = s[:l]+'1'*(len(s)-l)
return n-int(s, 2) # Chai Wah Wu, Dec 05 2024
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
Reinhard Zumkeller, Mar 23 2003
STATUS
approved
