cp's OEIS Frontend

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.

A385318 Number of nonnegative s < n such that s^s == (-s)^s (mod n).

This page as a plain text file.
%I A385318 #30 Aug 23 2025 00:05:56
%S A385318 1,2,2,2,3,4,4,4,6,6,6,6,7,8,8,8,9,12,10,10,11,12,12,12,15,14,18,14,
%T A385318 15,16,16,16,17,18,18,18,19,20,20,20,21,22,22,22,24,24,24,24,28,30,26,
%U A385318 26,27,36,28,28,29,30,30,30,31,32,33,32,33,34,34,34,35
%N A385318 Number of nonnegative s < n such that s^s == (-s)^s (mod n).
%C A385318 From _Robert Israel_, Aug 01 2025: (Start)
%C A385318 a(n) = ceiling(n/2) + the number of odd s < n such that 2 * s^s == 0 (mod n).
%C A385318 If n is divisible by 4, there are no such s, so a(n) = n/2.
%C A385318 If n == 2 (mod 4), then s = n/2 works, so a(n) >= n/2 + 1. (End)
%p A385318 f:= proc(n) local s;
%p A385318   ceil(n/2) + nops(select(s -> 2 * s &^ s mod n = 0, [seq(s, s = 1 .. n-1, 2)]))
%p A385318 end proc:
%p A385318 map(f, [$1..100]); # _Robert Israel_, Aug 01 2025
%t A385318 a[n_] := Count[Range[0, n-1], _?(PowerMod[#, #, n] == PowerMod[-#, #, n] &)]; Array[a, 100] (* _Amiram Eldar_, Jul 31 2025 *)
%o A385318 (Magma) [#[s: s in [0..n-1] | Modexp(s,s,n) eq Modexp(-s,s,n)]: n in [1..100]];
%o A385318 (PARI) a(n) = sum(s=0, n-1, Mod(s, n)^s == Mod(-s, n)^s); \\ _Michel Marcus_, Aug 07 2025
%Y A385318 Cf. A065295, A384781, A385103, A386409.
%K A385318 nonn,changed
%O A385318 1,2
%A A385318 _Juri-Stepan Gerasimov_, Jul 31 2025