login
a(n) = C(3n,n)/(2n+1) mod 3.
5

%I #29 Sep 14 2021 04:43:15

%S 1,1,0,0,1,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

%T 0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,

%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1

%N a(n) = C(3n,n)/(2n+1) mod 3.

%C a(n) differs from 0 only when n=(3^j-1)/2, j>=0. [Conjecture confirmed by _Kevin Ryde_, Jun 23 2021; see links]

%C Characteristic function of the ternary repunits, a(n) = 1 iff n is a ternary repunit (A003462). - _Kevin Ryde_, Jun 23 2021

%H Antti Karttunen, <a href="/A113047/b113047.txt">Table of n, a(n) for n = 0..29524</a>

%H Kevin Ryde, <a href="/A113047/a113047.txt">Proof of characteristic function of the ternary repunits</a>.

%F G.f.: A(x) satisfies A(x)=1+x*A(x^3). - _Vladimir Kruchinin_, Mar 24 2015

%F a(n) = A001764(n) mod 3. - _Michel Marcus_, Mar 24 2015

%F a(n) = floor(log_3(2*n + 1)) - floor(log_3(2*n - 1)), for n>=1. - _Ridouane Oudra_, Aug 24 2021

%t Table[Mod[Binomial[3 n, n]/(2 n + 1), 3], {n, 0, 72}] (* _Michael De Vlieger_, Mar 24 2015 *)

%o (PARI) A113047(n) = ((binomial(3*n,n)/(n+n+1))%3); \\ _Antti Karttunen_, Aug 28 2017

%o (PARI) a(n) = while(n, my(r);[n,r]=divrem(n,3); if(r!=1,return(0))); 1; \\ _Kevin Ryde_, Jun 23 2021

%Y Cf. A001764, A003462 (indices of 1's), A010872, A039969.

%K easy,nonn

%O 0,1

%A _Paul Barry_, Oct 11 2005

%E More terms from _Antti Karttunen_, Aug 28 2017