login
A295882
Balanced ternary representation of the deficiency of n, A033879(n).
8
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, 0, 28, 24, 30, 1, 45, 53, 49, 65, 36, 52, 49, 20, 40, 24, 159, 4, 12, 50, 154, 56, 161, 16, 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
OFFSET
1,3
LINKS
FORMULA
If A033879(n) >= 0, then a(n) = A117967(A033879(n)), otherwise a(n) = A117968(-A033879(n)).
For all n >= 1, A117966(a(n)) = A033879(n).
PROG
(PARI)
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))));
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))));
A295882(n) = { my(x = (2*n)-sigma(n)); if(x >= 0, A117967(x), A117968(-x)); };
(Scheme) (define (A295882 n) (let ((x (A033879 n))) (if (>= x 0) (A117967 x) (A117968 (- x)))))
CROSSREFS
Cf. A000396 (gives the positions of zeros).
Sequence in context: A275842 A147640 A096615 * A127551 A256547 A023138
KEYWORD
nonn
AUTHOR
Antti Karttunen, Dec 04 2017
STATUS
approved