login
A246159
Inverse function to the injection A048724.
6
0, 0, 0, 1, 0, 3, 2, 0, 0, 7, 6, 0, 4, 0, 0, 5, 0, 15, 14, 0, 12, 0, 0, 13, 8, 0, 0, 9, 0, 11, 10, 0, 0, 31, 30, 0, 28, 0, 0, 29, 24, 0, 0, 25, 0, 27, 26, 0, 16, 0, 0, 17, 0, 19, 18, 0, 0, 23, 22, 0, 20, 0, 0, 21, 0, 63, 62, 0, 60, 0, 0, 61, 56, 0, 0, 57, 0, 59, 58, 0, 48, 0, 0, 49, 0, 51, 50, 0, 0, 55, 54, 0, 52, 0, 0, 53, 32
OFFSET
0,6
COMMENTS
After a(0)=0, sequence has nonzero values a(n) = k at those positions n for which A048724(k) = n and zeros at those positions n which are not present in A048724.
Equally, sequence is obtained when the positive terms of A065620 are replaced with zeros and the sign of the negative terms is reversed.
LINKS
FORMULA
a(n) = (1/2) * A010059(n) * A006068(n).
a(n) = -1 * A010059(n) * A065620(n).
a(n) = A246160(n) - A065620(n).
a(n) = A010059(n) * A006068(A245710(n)).
For all n, a(A048724(n)) = n.
PROG
(Scheme, three different implementations)
(define (A246159 n) (* -1 (A010059 n) (A065620 n)))
(define (A246159 n) (* (/ 1 2) (A010059 n) (A006068 n)))
(define (A246159 n) (* (A010059 n) (A006068 (A245710 n))))
(PARI) a065620(n) = if(n<3, n, if(n%2, -2*a065620((n - 1)/2) + 1, 2*a065620(n/2)));
a(n) = -!(hammingweight(n)%2)*a065620(n);
for(n=0, 100, print1(a(n), ", ")) \\ Indranil Ghosh, Jun 07 2017
(Python)
def a065620(n): return n if n<3 else 2*a065620(n//2) if n%2==0 else -2*a065620((n - 1)//2) + 1
def a(n): return -(bin(n)[2:].count("1")%2==0)*a065620(n)
print([a(n) for n in range(101)]) # Indranil Ghosh, Jun 07 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Aug 18 2014
STATUS
approved