Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.
%I #14 Mar 05 2019 00:14:49
%S 1,2,3,4,3,5,3,4,6,7,3,8,3,9,10,4,3,11,3,12,13,14,3,15,16,17,18,19,3,
%T 20,3,4,21,22,23,24,3,25,26,27,3,28,3,29,30,31,3,32,33,34,35,36,3,37,
%U 38,39,40,41,3,42,3,43,44,4,45,46,3,47,48,49,3,50,3,51,52,53,54,55,3,56,57,58,3,59,60,61,62,63,3,64,65,66,67,68,69,70,3,71,72,73,3,74,3,75,76
%N Lexicographically earliest sequence such that a(i) = a(j) => f(i) = f(j) for all i, j >= 1, where f(n) = -1 if n is an odd prime, f(n) = -2 if n = 2^k, with k > 1, and f(n) = n for all other numbers.
%C For all i, j:
%C A305801(i) = A305801(j) => a(i) = a(j),
%C a(i) = a(j) => A305976(i) = A305976(j) => A001221(i) = A001221(j),
%C a(i) = a(j) => A322591(i) = A322591(j),
%C a(i) = a(j) => A323235(i) = A323235(j),
%C a(i) = a(j) => A324399(i) = A324399(j),
%C a(i) = a(j) => A297159(i) = A297159(j).
%H Antti Karttunen, <a href="/A324401/b324401.txt">Table of n, a(n) for n = 1..65537</a>
%F If n <= 2, a(n) = n, for n > 2, if n is an odd prime, a(n) = 3, if n = 2^k, with k >= 2, a(n) = 4, otherwise a(n) = 4 + n - A000523(n) - A000720(n).
%o (PARI)
%o A000523(n) = if(n<1, 0, #binary(n)-1);
%o A324401(n) = if(n<4,n,if(isprime(n),3,if(!bitand(n,n-1),4,4+n-A000523(n)-primepi(n))));
%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 Aux324401(n) = if((n>2) && (isprime(n)||!bitand(n,n-1)),-(2-(n%2)),n);
%o \\ Equally: Aux324401(n) = if(n<=2,n,if(isprime(n),-1,if(!bitand(n,n-1),-2,n)));
%o v324401 = rgs_transform(vector(up_to, n, Aux324401(n)));
%o A324401(n) = v324401[n];
%Y Cf. A000523, A000720.
%Y Cf. also A297159, A305801, A305976, A322591, A323235, A324399, A324400.
%K nonn
%O 1,2
%A _Antti Karttunen_, Mar 01 2019