login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Lexicographically earliest infinite sequence such that a(i) = a(j) => f(i) = f(j) for all i, j >= 1, where f(1) = 0 and for n > 1, f(n) = -1 if n is in A050376, and f(n) = A334870(n) otherwise.
3

%I #8 Jun 09 2020 07:24:27

%S 1,2,2,2,2,3,2,4,2,5,2,6,2,7,8,2,2,9,2,10,11,12,2,13,2,14,15,16,2,17,

%T 2,18,19,20,21,22,2,23,24,25,2,26,2,27,28,29,2,30,2,31,32,33,2,34,35,

%U 36,37,38,2,39,2,40,41,6,42,43,2,44,45,46,2,47,2,48,49,50,51,52,2,53,2,54,2,55,56,57,58,59,2,60,61,62,63,64,65,66,2,67,68,8,2,69,2,70,71

%N Lexicographically earliest infinite sequence such that a(i) = a(j) => f(i) = f(j) for all i, j >= 1, where f(1) = 0 and for n > 1, f(n) = -1 if n is in A050376, and f(n) = A334870(n) otherwise.

%C For all i, j: A305979(i) = A305979(j) => a(i) = a(j) => A334872(i) = A334872(j).

%H Antti Karttunen, <a href="/A334868/b334868.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 ispow2(n) = (n && !bitand(n,n-1));

%o A302777(n) = ispow2(isprimepower(n));

%o A334870(n) = if(issquare(n),sqrtint(n),my(c=core(n), m=n); forprime(p=2, , if(!(c % p), m/=p; break, m*=p)); (m));

%o A334868aux(n) = if(1==n,0,if(A302777(n),-1,A334870(n)));

%o v334868 = rgs_transform(vector(up_to,n,A334868aux(n)));

%o A334868(n) = v334868[n];

%Y Cf. A050376 (positions of 2's), A305979, A334869, A334870, A334872.

%K nonn

%O 1,2

%A _Antti Karttunen_, Jun 08 2020