login
Ordinal transform of A049820, where A049820(n) = n - d(n), with d(n) the number of divisors of n (A000005).
1

%I #11 Dec 22 2021 09:25:15

%S 1,2,1,2,1,1,1,1,1,2,1,3,1,1,2,3,1,1,1,1,2,1,1,1,1,2,1,3,1,4,1,1,2,1,

%T 1,2,1,1,2,1,1,2,1,1,2,1,1,2,1,1,1,2,1,3,2,1,1,1,1,2,1,1,2,3,1,2,1,1,

%U 2,2,1,1,1,1,2,2,1,3,1,4,1,1,1,1,2,1,1,1,1,2,2,1,1,1,1,1,1,1,1,2,1,1,1,1,1

%N Ordinal transform of A049820, where A049820(n) = n - d(n), with d(n) the number of divisors of n (A000005).

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

%t b[_] = 0;

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

%t Array[a, 105] (* _Jean-François Alcover_, Dec 22 2021 *)

%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 A049820(n) = (n-numdiv(n));

%o v330738 = ordinal_transform(vector(up_to, n, A049820(n)));

%o A330738(n) = v330738[n];

%Y Cf. A000005, A049820, A060990, A155043.

%K nonn

%O 1,2

%A _Antti Karttunen_, Jan 11 2020