cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A333773 Replace 2's with (-1)'s in ternary representation of n and sum nonzero terms with alternating signs.

This page as a plain text file.
%I A333773 #9 Apr 07 2020 12:19:48
%S A333773 0,1,-1,3,2,4,-3,-4,-2,9,8,10,6,7,5,12,13,11,-9,-10,-8,-12,-11,-13,-6,
%T A333773 -5,-7,27,26,28,24,25,23,30,31,29,18,19,17,21,20,22,15,14,16,36,37,35,
%U A333773 39,38,40,33,32,34,-27,-28,-26,-30,-29,-31,-24,-23,-25,-36
%N A333773 Replace 2's with (-1)'s in ternary representation of n and sum nonzero terms with alternating signs.
%C A333773 This sequence is a variant of A117966, and shares features with A065620.
%C A333773 Every integer appears exactly once in this sequence.
%H A333773 Rémy Sigrist, <a href="/A333773/b333773.txt">Table of n, a(n) for n = 0..6561</a>
%F A333773 a(3*n)   = 3*a(n).
%F A333773 a(3*n+1) = 3*a(n) + (-1)^A160384(n).
%F A333773 a(3*n+2) = 3*a(n) - (-1)^A160384(n).
%F A333773 Sum_{k=0..n} a(k) >= 0 with equality iff n belongs to A024023.
%F A333773 a(n) > 0 iff n belongs to A132141.
%F A333773 a(n) < 0 iff n belongs to A157671.
%F A333773 a(A004488(n)) = -a(n).
%e A333773 For n = 97:
%e A333773 - 97 = 3^4 + 3^2 + 2*3^1 + 3^0,
%e A333773 - hence a(97) = 3^4 - 3^2 + (-1)*3^1 - 3^0 = 68.
%o A333773 (PARI) a(n) = { my (v=0, t=Vecrev(digits(n,3))); for (k=1, #t, if (t[k]==1, v=+3^(k-1)-v, t[k]==2, v=-3^(k-1)-v)); v }
%Y A333773 Cf. A004488, A024023, A065620, A117966, A132141, A157671, A160384, A333780.
%K A333773 sign,base
%O A333773 0,4
%A A333773 _Rémy Sigrist_, Apr 05 2020