%I #16 Nov 21 2021 01:17:51
%S 1,2,2,3,2,4,2,5,6,7,2,8,2,9,10,11,2,12,2,13,14,15,2,16,17,18,19,20,2,
%T 2,2,21,22,23,24,25,2,26,27,28,2,2,2,29,30,31,2,32,33,34,35,36,2,37,
%U 38,39,40,41,2,42,2,43,44,45,46,2,2,47,48,2,2,49,2,50,51,52,53,2,2,54,55,56,2,57,58,59,60,61,2,62,63,64,65,66,67,68,2,69,70,71
%N Lexicographically earliest infinite sequence such that a(i) = a(j) => f(i) = f(j), for all i, j >= 1, where f(n) = 0 if mu(n) = -1, and f(n) = n for all other numbers (with mu = Möbius mu, A008683).
%C Restricted growth sequence transform of the sequence f(n) = 0 if mu(n) = -1, and f(n) = n for mu(n) >= 0.
%C For all i, j:
%C A305800(i) = A305800(j) => a(i) = a(j) => A305980(i) = A305980(j),
%C a(i) = a(j) => b(i) = b(j), where b is the pointwise sum of any two multiplicative sequences c and d that are Dirichlet inverses of each other. For example, b can be a sequence like A319340, A323885, or A347094.
%H Antti Karttunen, <a href="/A346488/b346488.txt">Table of n, a(n) for n = 1..65537</a>
%F a(1) = 1, and for n > 1, if A008683(n) = -1, a(n) = 2, otherwise a(n) = 1 + n - A070549(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 Aux346488(n) = if(moebius(n)<0,0,n);
%o v346488 = rgs_transform(vector(up_to, n, Aux346488(n)));
%o A346488(n) = v346488[n];
%o (PARI)
%o A070549(n) = sum(k=1,n,(-1==moebius(k)));
%o A346488(n) = if(1==n,1,if(-1==moebius(n),2,1+n-A070549(n)));
%Y Cf. A008683, A070549, A030059 (positions of 2's).
%Y Cf. also A305800, A305980, A319340, A323885, A347094.
%K nonn
%O 1,2
%A _Antti Karttunen_, Aug 20 2021
|