OFFSET
1,2
MAPLE
# REVERT from N. J. A. Sloane's 'Transforms' (see the footer of the page).
REVERT([seq(if isprime(k) then k else 1 fi, k = 1..25)]);
# Alternative:
CompInv := proc(len, seqfun) local n, k, m, g, M, A;
A := [seq(seqfun(i), i=1..len)];
M := Matrix(len+1, shape=triangular[lower]); M[1, 1] := 1;
for m from 2 to len + 1 do M[m, m] := M[m - 1, m - 1]/A[1];
for k from m-1 by -1 to 2 do M[m, k] := M[m-1, k-1] -
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:
CompInv(25, n -> if isprime(n) then n else 1 fi);
CROSSREFS
KEYWORD
sign
AUTHOR
Peter Luschny, Oct 04 2022
STATUS
approved