login
Write n and 3n in ternary representation and add all trits modulo 3.
8

%I #12 Jan 19 2022 11:16:52

%S 0,4,8,12,16,11,24,19,23,36,40,44,48,52,47,33,28,32,72,76,80,57,61,56,

%T 69,64,68,108,112,116,120,124,119,132,127,131,144,148,152,156,160,155,

%U 141,136,140,99,103,107,84,88,83,96,91,95,216,220,224,228,232

%N Write n and 3n in ternary representation and add all trits modulo 3.

%H Reinhard Zumkeller, <a href="/A242399/b242399.txt">Table of n, a(n) for n = 0..10000</a>

%H P. Mathonet, M. Rigo, M. Stipulanti and N. Zénaïdi, <a href="https://arxiv.org/abs/2201.06636">On digital sequences associated with Pascal's triangle</a>, arXiv:2201.06636 [math.NT], 2022.

%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/Ternary.html">Ternary.</a>

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Ternary_numeral_system">Ternary numeral system</a>

%H <a href="/index/Ca#CARRYLESS">Index entries for sequences related to carryless arithmetic</a>

%F a(n) <= 4*n; a(m) = 4*m iff m is a term of A242407.

%F a(n) = A008586(n) - A242400(n).

%e n = 25, 3*n = 75:

%e . A007089(25) = 221

%e . A007089(75) = 2210

%e . add trits ----

%e . modulo 3 2101 = A007089(64), hence a(25) = 64.

%o (Haskell)

%o a242399 n = foldr (\t v -> 3 * v + t) 0 $

%o map (flip mod 3) $ zipWith (+) ([0] ++ ts) (ts ++ [0])

%o where ts = a030341_row n

%Y Cf. A004488, A007089, A008586, A030341, A048724, A242400, A242407.

%Y Row / column 4 of A325820.

%K nonn,base

%O 0,2

%A _Reinhard Zumkeller_, May 13 2014