login
The compositional inverse of n -> n^[isprime(n)], where [b] is the Iverson bracket of b.
17

%I #7 Oct 05 2022 02:53:51

%S 1,-2,5,-11,6,146,-1295,7712,-36937,141514,-357676,-322973,12078666,

%T -102218510,623243991,-3041134727,11440387382,-23657862864,

%U -95377084665,1570488584608,-12255377466362,72288056416374,-340793435817068,1186234942871544,-1525020468715715

%N The compositional inverse of n -> n^[isprime(n)], where [b] is the Iverson bracket of b.

%p # REVERT from N. J. A. Sloane's 'Transforms' (see the footer of the page).

%p REVERT([seq(if isprime(k) then k else 1 fi, k = 1..25)]);

%p # Alternative:

%p CompInv := proc(len, seqfun) local n, k, m, g, M, A;

%p A := [seq(seqfun(i), i=1..len)];

%p M := Matrix(len+1, shape=triangular[lower]); M[1,1] := 1;

%p for m from 2 to len + 1 do M[m, m] := M[m - 1, m - 1]/A[1];

%p for k from m-1 by -1 to 2 do M[m, k] := M[m-1, k-1] -

%p add(A[i+1]*M[m, k+i], i=1..m-k)/A[1] od od; seq(M[k, 2], k=2..len + 1) end:

%p CompInv(25, n -> if isprime(n) then n else 1 fi);

%Y Cf. A089026, A357368.

%K sign

%O 1,2

%A _Peter Luschny_, Oct 04 2022