login
Compound filter: a(n) = T(A051953(n), A046523(n)), where T(n,k) is sequence A000027 used as a pairing function.
6

%I #16 Feb 16 2025 08:33:44

%S 0,2,2,12,2,40,2,59,18,61,2,179,2,86,73,261,2,265,2,265,100,148,2,757,

%T 33,185,129,367,2,1297,2,1097,166,271,131,1735,2,320,205,1105,2,1741,

%U 2,619,517,430,2,3113,52,850,295,769,2,1747,205,1517,346,625,2,5297,2,698,730,4497,248,2821,2,1117,460,2821,2,7069,2,941,1070,1315,248,3457,2,4513

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

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

%H MathWorld, <a href="https://mathworld.wolfram.com/PairingFunction.html">Pairing Function</a>

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

%t Table[(2 + (#1 + #2)^2 - #1 - 3 #2)/2 & @@ {n - EulerPhi@ n, Times @@ MapIndexed[Prime[First@ #2]^#1 &, Sort[FactorInteger[n][[All, -1]], Greater]] - Boole[n == 1]}, {n, 80}] (* _Michael De Vlieger_, May 04 2017 *)

%o (PARI)

%o A051953(n) = (n - eulerphi(n));

%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 A286152(n) = (2 + ((A051953(n)+A046523(n))^2) - A051953(n) - 3*A046523(n))/2;

%o for(n=1, 10000, write("b286152.txt", n, " ", A286152(n)));

%o (Scheme) (define (A286152 n) (* (/ 1 2) (+ (expt (+ (A051953 n) (A046523 n)) 2) (- (A051953 n)) (- (* 3 (A046523 n))) 2)))

%o (Python)

%o from sympy import factorint, totient

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

%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): return T(n - totient(n), a046523(n)) # _Indranil Ghosh_, May 05 2017

%Y Cf. A000027, A046523, A051953, A285729, A286142, A286143, A286144, A286149, A286154, A286160, A286161, A286162, A286163, A286164.

%K nonn,changed

%O 1,2

%A _Antti Karttunen_, May 04 2017