login
Ordinal transform of cototient (A051953).
3

%I #18 Dec 19 2021 12:31:43

%S 1,1,2,1,3,1,4,2,1,1,5,1,6,2,1,3,7,1,8,2,1,3,9,1,1,1,2,2,10,1,11,3,1,

%T 1,1,1,12,1,1,2,13,1,14,3,1,4,15,1,2,2,1,1,16,1,2,2,2,3,17,1,18,3,1,4,

%U 1,1,19,2,1,2,20,1,21,1,1,1,2,1,22,2,2,1,23,1,3,2,1,3,24,1,2,4,1,5,1,1,25,1,1,2,26,1,27,2,1

%N Ordinal transform of cototient (A051953).

%C Number of values of k, 1 <= k <= n, with A051953(k) = A051953(n).

%H Antti Karttunen, <a href="/A303753/b303753.txt">Table of n, a(n) for n = 1..65537</a>

%F For all n >= 1, a(A000040(n)) = n.

%p b:= proc() 0 end:

%p a:= proc(n) option remember; local t;

%p t:= numtheory[phi](n)-n; b(t):= b(t)+1

%p end:

%p seq(a(n), n=1..120); # _Alois P. Heinz_, Apr 30 2018

%t b[_] = 0;

%t a[n_] := a[n] = With[{t = EulerPhi[n]-n}, b[t] = b[t]+1];

%t Array[a, 120] (* _Jean-François Alcover_, Dec 19 2021, after _Alois P. Heinz_ *)

%o (PARI)

%o up_to = 65537;

%o ordinal_transform(invec) = { my(om = Map(), outvec = vector(length(invec)), pt); for(i=1, length(invec), if(mapisdefined(om,invec[i]), pt = mapget(om, invec[i]), pt = 0); outvec[i] = (1+pt); mapput(om,invec[i],(1+pt))); outvec; };

%o A051953(n) = (n - eulerphi(n));

%o v303753 = ordinal_transform(vector(up_to,n,A051953(n)));

%o A303753(n) = v303753[n];

%Y Cf. A051953, A065385 (gives a subset of the positions of ones).

%Y Cf. also A081373, A303754.

%K nonn

%O 1,3

%A _Antti Karttunen_, Apr 30 2018