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.
%I A295882 #8 Dec 04 2017 18:36:29 %S A295882 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 A295882 0,28,24,30,1,45,53,49,65,36,52,49,20,40,24,159,4,12,50,154,56,161,16, %U A295882 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 A295882 Balanced ternary representation of the deficiency of n, A033879(n). %H A295882 Antti Karttunen, <a href="/A295882/b295882.txt">Table of n, a(n) for n = 1..16384</a> %F A295882 If A033879(n) >= 0, then a(n) = A117967(A033879(n)), otherwise a(n) = A117968(-A033879(n)). %F A295882 For all n >= 1, A117966(a(n)) = A033879(n). %o A295882 (PARI) %o A295882 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 A295882 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 A295882(n) = { my(x = (2*n)-sigma(n)); if(x >= 0,A117967(x),A117968(-x)); }; %o A295882 (Scheme) (define (A295882 n) (let ((x (A033879 n))) (if (>= x 0) (A117967 x) (A117968 (- x))))) %Y A295882 Cf. A033879, A033880, A117966, A117967, A117968, A286449, A295881, A296071, A296072, A296073. %Y A295882 Cf. A000396 (gives the positions of zeros). %K A295882 nonn %O A295882 1,3 %A A295882 _Antti Karttunen_, Dec 04 2017