login
A246160
Inverse function to the injection A065621.
5
0, 1, 2, 0, 4, 0, 0, 3, 8, 0, 0, 7, 0, 5, 6, 0, 16, 0, 0, 15, 0, 13, 14, 0, 0, 9, 10, 0, 12, 0, 0, 11, 32, 0, 0, 31, 0, 29, 30, 0, 0, 25, 26, 0, 28, 0, 0, 27, 0, 17, 18, 0, 20, 0, 0, 19, 24, 0, 0, 23, 0, 21, 22, 0, 64, 0, 0, 63, 0, 61, 62, 0, 0, 57, 58, 0, 60, 0, 0, 59, 0, 49, 50, 0, 52
OFFSET
0,3
COMMENTS
Sequence has nonzero values a(n) = k at those points n for which A065621(k) = n and zeros at those positions n which are not present in A065621.
Equally, sequence is obtained when the negative terms of A065620 are replaced with zeros
LINKS
FORMULA
a(n) = A010060(n) * A065620(n).
a(n) = A246159(n) + A065620(n).
a(0) = 0, and for n >= 1, a(n) = A010060(n) * (1 + A006068(A115384(n)-1)).
For all n, a(A065621(n)) = n.
PROG
(Scheme, two different implementations)
(define (A246160 n) (* (A010060 n) (A065620 n)))
(define (A246160 n) (if (zero? n) n (* (A010060 n) (1+ (A006068 (-1+ (A115384 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)*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