%I #8 Dec 04 2017 18:36:29
%S 1,1,5,1,4,0,15,1,17,5,10,8,12,4,15,1,52,6,45,7,10,11,49,24,46,10,53,
%T 0,28,24,30,1,45,53,49,65,36,52,49,20,40,24,159,4,12,50,154,56,161,16,
%U 30,15,142,24,41,19,43,29,139,204,150,28,49,1,154,24,147,10,159,8,106,192,99,43,29,12,139,24,87,55
%N Balanced ternary representation of the deficiency of n, A033879(n).
%H Antti Karttunen, <a href="/A295882/b295882.txt">Table of n, a(n) for n = 1..16384</a>
%F If A033879(n) >= 0, then a(n) = A117967(A033879(n)), otherwise a(n) = A117968(-A033879(n)).
%F For all n >= 1, A117966(a(n)) = A033879(n).
%o (PARI)
%o A117967(n) = if(n<=1,n,if(!(n%3),3*A117967(n/3),if(1==(n%3),1+3*A117967((n-1)/3),2+3*A117967((n+1)/3))));
%o A117968(n) = if(1==n,2,if(!(n%3),3*A117968(n/3),if(1==(n%3),2+3*A117968((n-1)/3),1+3*A117968((n+1)/3))));
%o A295882(n) = { my(x = (2*n)-sigma(n)); if(x >= 0,A117967(x),A117968(-x)); };
%o (Scheme) (define (A295882 n) (let ((x (A033879 n))) (if (>= x 0) (A117967 x) (A117968 (- x)))))
%Y Cf. A033879, A033880, A117966, A117967, A117968, A286449, A295881, A296071, A296072, A296073.
%Y Cf. A000396 (gives the positions of zeros).
%K nonn
%O 1,3
%A _Antti Karttunen_, Dec 04 2017