login
Compound filter: a(n) = T(A001511(n), A278222(n)), where T(n,k) is sequence A000027 used as a pairing function.
16

%I #13 May 13 2017 05:19:00

%S 2,5,7,9,16,12,29,14,16,23,67,18,67,38,121,20,16,23,67,31,436,80,277,

%T 25,67,80,631,48,277,138,497,27,16,23,67,31,436,80,277,40,436,467,

%U 1771,94,1771,302,1129,33,67,80,631,94,1771,668,2557,59,277,302,2557,156,1129,530,2017,35,16,23,67,31,436,80,277,40,436,467,1771,94,1771,302,1129,50

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

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

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

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

%o (PARI)

%o A001511(n) = (1+valuation(n,2));

%o A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t }; \\ Modified from code of _M. F. Hasler_

%o A046523(n) = { my(f=vecsort(factor(n)[, 2], , 4), p); prod(i=1, #f, (p=nextprime(p+1))^f[i]); }; \\ This function from _Charles R Greathouse IV_, Aug 17 2011

%o A278222(n) = A046523(A005940(1+n));

%o A286162(n) = (2 + ((A001511(n)+A278222(n))^2) - A001511(n) - 3*A278222(n))/2;

%o for(n=1, 10000, write("b286162.txt", n, " ", A286162(n)));

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

%o (Python)

%o from sympy import prime, factorint

%o import math

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

%o def A(n): return n - 2**int(math.floor(math.log(n, 2)))

%o def b(n): return n + 1 if n<2 else prime(1 + (len(bin(n)[2:]) - bin(n)[2:].count("1"))) * b(A(n))

%o def a005940(n): return b(n - 1)

%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 a278222(n): return a046523(a005940(n + 1))

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

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

%Y Cf. A000027, A001511, A278222, A286160, A286161, A286163, A286164.

%K nonn

%O 1,1

%A _Antti Karttunen_, May 04 2017