OFFSET
0,5
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
FORMULA
Write n in ternary, replace each pair of adjacent digits by their modulo 3 sum.
EXAMPLE
15 = 120 in ternary, derivative is 02 = 2, so a(15)=2.
MATHEMATICA
Table[FromDigits[Mod[Total[#], 3]&/@Partition[IntegerDigits[n, 3], 2, 1], 3], {n, 0, 100}] (* Harvey P. Dale, Nov 01 2024 *)
PROG
(Haskell)
a038555 n = foldr (\d v -> v * 3 + d) 0 $
zipWith (\x y -> (x + y) `mod` 3) ts $ tail ts
where ts = a030341_row n
-- Reinhard Zumkeller, May 26 2013
(J) ab3 =: 3&#.^:_1
sp =: 2&(+/\)"1
> (3 | sp)&.ab3&.> ; / i. 100 NB. Stephen Makdisi, May 26 2018
CROSSREFS
KEYWORD
nonn,nice,easy,base
AUTHOR
EXTENSIONS
More terms from Erich Friedman
Formula corrected by Reinhard Zumkeller, May 26 2013
STATUS
approved