cp's OEIS Frontend

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.

A246160 Inverse function to the injection A065621.

This page as a plain text file.
%I A246160 #21 May 06 2021 11:04:44
%S A246160 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,
%T A246160 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,
%U A246160 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
%N A246160 Inverse function to the injection A065621.
%C A246160 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.
%C A246160 Equally, sequence is obtained when the negative terms of A065620 are replaced with zeros
%H A246160 Antti Karttunen, <a href="/A246160/b246160.txt">Table of n, a(n) for n = 0..8192</a>
%F A246160 a(n) = A010060(n) * A065620(n).
%F A246160 a(n) = A246159(n) + A065620(n).
%F A246160 a(0) = 0, and for n >= 1, a(n) = A010060(n) *  (1 + A006068(A115384(n)-1)).
%F A246160 For all n, a(A065621(n)) = n.
%o A246160 (Scheme, two different implementations)
%o A246160 (define (A246160 n) (* (A010060 n) (A065620 n)))
%o A246160 (define (A246160 n) (if (zero? n) n (* (A010060 n) (1+ (A006068 (-1+ (A115384 n)))))))
%o A246160 (PARI)
%o A246160 a065620(n) = if(n<3, n, if(n%2, -2*a065620((n - 1)/2) + 1, 2*a065620(n/2)));
%o A246160 a(n) = (hammingweight(n)%2)*a065620(n);
%o A246160 for(n=0, 100, print1(a(n),", ")) \\ _Indranil Ghosh_, Jun 07 2017
%o A246160 (Python)
%o A246160 def a065620(n): return n if n<3 else 2*a065620(n//2) if n%2==0 else -2*a065620((n - 1)//2) + 1
%o A246160 def a(n): return (bin(n)[2:].count("1")%2)*a065620(n)
%o A246160 print([a(n) for n in range(101)]) # _Indranil Ghosh_, Jun 07 2017
%Y A246160 Cf. A246159, A006068, A010060, A115384, A065620, A065621.
%K A246160 nonn
%O A246160 0,3
%A A246160 _Antti Karttunen_, Aug 18 2014