%I #7 Dec 27 2018 17:36:30
%S 0,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,
%T 1,1,1,1,1,-1,1,1,1,1,0,1,1,-1,1,2,1,1,1,1,1,-1,1,1,1,0,1,1,0,1,1,1,1,
%U 1,1,1,1,1,1,1,1,1,1,1,1,-1,1,1,1,0,1,1,1,1,1,1,1,1,1,1,1,-1,1,2,1,2,1,1,1,1,1
%N a(n) = A001222(A065642(n)) - A001222(n), where A065642(n) gives the next larger m that has same prime factors as n (ignoring multiplicity), and A001222 gives the number of prime factors, when counted with multiplicity.
%H Antti Karttunen, <a href="/A322817/b322817.txt">Table of n, a(n) for n = 1..20000</a>
%F a(n) = A001222(A065642(n)) - A001222(n).
%e For n = 2 = 2^1, the next larger number with only 2's as its prime factors is 4 = 2^2, thus a(2) = 1.
%e For n = 12 = 2^2 * 3^1, the next larger number with the same prime factors is 18 = 2^1 * 3^2, with the same value of A001222, thus a(12) = 0.
%e For n = 40 = 2^3 * 5^1, the next larger number with the same prime factors is 50 = 2^1 * 5^2. While 40 has 3+1 = 4 prime factors in total, 50 has 1+2 = 3, thus a(40) = 3 - 4 = -1.
%e For n = 50, the next larger number with the same prime factors is 80 = 2^4 * 5^1, thus a(50) = (4+1)-(2+1) = 2.
%o (PARI)
%o A007947(n) = factorback(factorint(n)[, 1]);
%o A065642(n) = { my(r=A007947(n)); if(1==n, n, n = n+r; while(A007947(n) <> r, n = n+r); n); };
%o A322817(n) = (bigomega(A065642(n)) - bigomega(n));
%Y Cf. A001222, A065642, A322818.
%K sign
%O 1,50
%A _Antti Karttunen_, Dec 27 2018