This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A347291 #30 Oct 01 2023 02:38:19 %S A347291 1,2,2,2,2,4,2,4,3,4,2,4,2,4,4,8,2,6,2,4,4,4,2,8,5,4,9,4,2,8,2,16,4,4, %T A347291 4,6,2,4,4,8,2,8,2,4,6,4,2,16,7,10,4,4,2,18,4,8,4,4,2,8,2,4,6,32,4,8, %U A347291 2,4,4,8,2,12,2,4,10,4,4,8,2,16,27,4,2,8,4 %N A347291 Multiplicative function defined by a(p) = 2 and a(p^k) = p^(k-1) for k >= 2. %C A347291 a(n) is the least number of distinct values mod n attained by a polynomial p(x) such that p(x) == 0 (mod n) if and only if x == 0 (mod n). %H A347291 Math StackExchange, <a href="https://math.stackexchange.com/q/4080417">Smallest number of residue classes for a polynomial function mod n that separates 0</a>. %F A347291 If n = p1^k1 p2^k2 ... pr^kr, then a(n) = a(p1^k1) a(p2^k2) ... a(pr^kr), where a(p^k) is 2 if k=1 and p^(k-1) if k>=2. %F A347291 Dirichlet g.f.: zeta(s-1) * Product_{p prime} (1 - 1/p^(s-1) + 2/p^s - 1/p^(2*s-1)). - _Amiram Eldar_, Oct 01 2023 %e A347291 For n = 8, a(8) = a(2^3) = 2^2 = 4. Also, any polynomial p(x) that is 0 only for x == 0 (mod 8) takes at least a(8)=4 distinct values. (The polynomial p(x) = x^3 + x is an example.) %e A347291 When n is a prime number, the polynomial p(x) = x^(n-1), by Fermat's little theorem, is 0 (mod n) when x == 0 (mod n), and 1 (mod n) otherwise. So it takes only two distinct values, and a(p) = 2. %e A347291 a(360) = a(2^3 * 3^2 * 5) = 2^2 * 3 * 2 = 24. %t A347291 f[p_, e_] := If[e == 1, 2, p^(e - 1)]; a[n_] := Times @@ f @@@ FactorInteger[n]; a[1] = 1; Array[a, 100] (* _Amiram Eldar_, Jan 23 2022 *) %o A347291 (Python) %o A347291 from sympy import factorint, prod %o A347291 def a(n): %o A347291 return prod((2 if k == 1 else p**(k-1)) for (p, k) in factorint(n).items()) %o A347291 (PARI) a(n) = { my(f = factor(n)); for(i = 1, #f~, if(f[i, 2] == 1, f[i, 1] = 2; , f[i, 2]--; ) ); factorback(f) } \\ _David A. Corneth_, Jan 22 2022 %K A347291 nonn,easy,mult %O A347291 1,2 %A A347291 _Shreevatsa R_, Jan 22 2022 %E A347291 Corrected and extended by _David A. Corneth_, Jan 22 2022