Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).
%I #7 Jan 13 2019 19:29:49
%S 1,2,3,4,3,4,3,5,6,5,3,5,3,7,8,9,3,7,3,9,10,11,3,9,12,13,14,15,3,9,3,
%T 16,12,16,17,13,3,18,17,16,3,13,3,19,20,21,3,16,22,19,23,24,3,18,25,
%U 26,27,28,3,16,3,29,30,31,32,33,3,31,34,24,3,26,3,35,25,36,37,26,3,31,38,39,3,26,40,41,42,39,3,26,43,44,37,45,46,31,3,41,47,39,3,31,3,48
%N Lexicographically earliest sequence such that for all i, j, a(i) = a(j) => f(i) = f(j) where f(n) = A323373(n) for all other numbers, except f(p) = -(p mod 2) for primes p.
%C For all i, j:
%C A305801(i) = A305801(j) => a(i) = a(j),
%C a(i) = a(j) => A039651(i) = A039651(j).
%H Antti Karttunen, <a href="/A323374/b323374.txt">Table of n, a(n) for n = 1..65537</a>
%o (PARI)
%o up_to = 65537;
%o rgs_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), u=1); for(i=1, length(invec), if(mapisdefined(om,invec[i]), my(pp = mapget(om, invec[i])); outvec[i] = outvec[pp] , mapput(om,invec[i],i); outvec[i] = u; u++ )); outvec; };
%o A049559(n) = gcd(eulerphi(n), n-1);
%o A160595(n) = if(1==n, n, numerator(eulerphi(n)/(n-1)));
%o Aux323374(n) = if(isprime(n),-(n%2),[A049559(n), A160595(n)]);
%o v323374 = rgs_transform(vector(up_to, n, Aux323374(n)));
%o A323374(n) = v323374[n];
%Y Cf. A039651, A049559, A160595, A323373.
%Y Cf. also A322587, A322592, A323405.
%K nonn
%O 1,2
%A _Antti Karttunen_, Jan 13 2019