Irreducible polynomials over GF(5)

Jelly, 302322 20 bytes

ÆF>1’PḄ
ÆDµU5*×Ç€S:Ṫ


Try it online! or verify all test cases at once.

Algorithm

This uses the formula

$$\text{A001692}(n) = \frac 1 n \sum_{d|n} \mu(d)5^\frac n d$$

from the OEIS page, where $$\d | n\$$ indicates that we sum over all divisors $$\d\$$ of $$\n\$$, and $$\\mu\$$ represents the Möbius function.

Code

ÆF>1’PḄ       Monadic helper link. Argument: d
This link computes the Möbius function of d.

ÆF            Factor d into prime-exponent pairs.
>1          Compare each prime and exponent with 1. Returns 1 or 0.
’         Decrement each Boolean, resulting in 0 or -1.
P        Take the product of all Booleans, for both primes and exponents.
Ḅ       Convert from base 2 to integer. This is a sneaky way to map [0, b] to
b and [] to 0.

ÆD            Compute all divisors of n.
µ           Begin a new, monadic chain. Argument: divisors of n
U          Reverse the divisors, effectively computing n/d for each divisor d.
5*        Compute 5 ** (n/d) for each n/d.

Ç€     Map the helper link over the (ascending) divisors.
×       Multiply the powers by the results from Ç.
:Ṫ  Divide the sum by the last divisor (n).


Mathematica, 39 38 bytes

DivisorSum[a=#,5^(a/#)MoebiusMu@#/a&]&


Uses the same formula as the Jelly answer.