login
Compound filter: a(n) = P(A001511(n), A286364(n)), where P(n,k) is sequence A000027 used as a pairing function.
3

%I #12 Feb 16 2025 08:33:45

%S 1,3,2,6,4,5,2,10,22,8,2,9,4,5,11,15,4,30,2,13,121,5,2,14,46,8,407,9,

%T 4,17,2,21,121,8,11,39,4,5,11,19,4,138,2,9,67,5,2,20,22,57,11,13,4,

%U 437,11,14,121,8,2,24,4,5,2212,28,211,138,2,13,121,17,2,49,4,8,92,9,121,17,2,26,7261,8,2,156,211,5,11,14,4,80,11,9,121,5,11,27,4,30

%N Compound filter: a(n) = P(A001511(n), A286364(n)), where P(n,k) is sequence A000027 used as a pairing function.

%C This sequence contains, in addition to the information contained in A286364 (which packs the values of A286361(n) and A286363(n) to a single value with the pairing function A000027), also the highest power of 2 dividing n. Note that this is more information than A286365, as it stores only the parity of the exponent of 2.

%C For all i, j: a(i) = a(j) => A286161(i) = A286161(j).

%H Antti Karttunen, <a href="/A286367/b286367.txt">Table of n, a(n) for n = 1..10000</a>

%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PairingFunction.html">Pairing Function</a>

%F a(n) = (1/2)*(2 + ((A001511(n)+A286364(n))^2) - A001511(n) - 3*A286364(n)).

%o (Scheme) (define (A286367 n) (* (/ 1 2) (+ (expt (+ (A001511 n) (A286364 n)) 2) (- (A001511 n)) (- (* 3 (A286364 n))) 2)))

%o (Python)

%o from sympy import factorint

%o from operator import mul

%o def P(n):

%o f = factorint(n)

%o return sorted([f[i] for i in f])

%o def a046523(n):

%o x=1

%o while True:

%o if P(n) == P(x): return x

%o else: x+=1

%o def A(n, k):

%o f = factorint(n)

%o return 1 if n == 1 else reduce(mul, [1 if i%4==k else i**f[i] for i in f])

%o def T(n, m): return ((n + m)**2 - n - 3*m + 2)/2

%o def a286364(n): return T(a046523(n/A(n, 1)), a046523(n/A(n, 3)))

%o def a001511(n): return 2 + bin(n - 1)[2:].count("1") - bin(n)[2:].count("1")

%o def a(n): return T(a001511(n), a286364(n)) # _Indranil Ghosh_, May 09 2017

%Y Cf. A000027, A001511, A286161, A286361, A286363, A286364, A286365.

%K nonn,changed

%O 1,2

%A _Antti Karttunen_, May 08 2017