Symbolic Raku, 17 bytes
Try it online!
Suprisingly, this is shorter than the my previous Raku answer, though one byte longer than using the built-in
$_= # Set the output to
?( ) # The boolean of
$_ # If the input is
%% # Divisible by
[^] # Only one ...
tq, 10 bytes
Uses Wilson's theorem to do the prime-checking.
?-1! # Generate all numbers from 2 to input - 1
x, # Preserve this value, prevent it from being printed
p*p # Generate all possible combinations of those numbers
%? # Does the product of any combination equal to the input?
Spice, 93 bytes
;i;m;t;c;r@REA i;ADD 0 1 c;SUB i 1 m;ADD c 1 c;MOD i c t;SWI t 1 9;SWI c m 3;ADD 0 1 r;OUT r;
This outputs  for a prime, and  for a non-prime.
;i;m;t;c;r@ - Declare vars (@ marks end of declarations)
(line 0) REA i; - Read input into i
(line 1) ADD 0 1 c; - Set counter c = 1
(line 2) SUB i 1 m; - Set ...
APL(NARS), 47 chars, 94 bytes
where m and n are the function one has to use (this because i don't know how
to call one array of function in one function in APL).
Using the example above the multiplication of Mobius function (here it is 12π) and sum of divisors
function (here it is 11π) for value 12 that ...
Charcoal, 33 bytes
Try it online! Link is to verbose version of code. 0-indexed; on input, the 0th element is a dummy, while on output, it's a duplicate. Explanation:
Loop over the indices of the input list.
Save the results as we go.
Each term is divided by \$f(1)\$.
For the 0th and 1st terms, ...
Jelly, 30 29 bytes
Try it online!
I’m sure there’s a golfier way of doing this. A pair of links which is called as a monad with the list of integers as the argument. Returns a list of integers.
Takes n as its left argument and the current pair of outputs for g and f as its right argument
MATL, 32 bytes
Try it online! Or verify all test cases.
How it works
1 % Push 1
i % Take input: f, of size L
1) % Get its first entry: f(1)
/ % Divide: gives 1/f(1). This is g(1). It will later be expanded into
% a vector to include g(2), g(3), ... g(L)
G % Push input again
W d, 5 bytes
(Possibly the only <=5-byter that does not use a prime or number factorization built-in?)
And, just for the lols (explanation for this program is also below, without the implicitly provided ba):
W d, 13 7 bytes
W doesn't have a boring primalty test operation, which is why this program is so long. (IMO a 7-byte ...
APL (Dyalog Classic), 8 bytes
My first time using APL, thanks to H.PWiz for shortening it into a train
Essentially a port of the Jelly answer
∘⍳ Numbers from 1 to input inclusive
+\ Cumulative reduce with addition, gets triangular numbers
⍣2 Repeat (does it again) to get the tetrahedral numbers