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.

A374964 a(n) is the smallest positive k such that -n^n == n (mod n + k).

This page as a plain text file.
%I A374964 #22 Aug 13 2024 02:22:37
%S A374964 1,1,2,1,5,1,3,1,9,1,11,1,13,1,14,1,17,1,7,1,21,1,23,1,25,1,3,1,29,1,
%T A374964 6,1,33,1,35,1,37,1,39,1,41,1,7,1,45,1,18,1,49,1,50,1,53,1,19,1,45,1,
%U A374964 59,1,61,1,7,1,65,1,63,1,44,1,71,1,40,1,12,1,12,1,27,1,81,1,23,1,85,1,58,1,8,1,6,1,9
%N A374964 a(n) is the smallest positive k such that -n^n == n (mod n + k).
%F A374964 a(n) = 1 for n even and a(n) <= n for n odd. - _Michael S. Branicky_, Jul 28 2024
%F A374964 a(n) + n is the least divisor > n of n^n + n. - _Robert Israel_, Jul 30 2024
%p A374964 f:= proc(n) local k;
%p A374964   for k from 1 do if n &^ n + n mod (n+k) = 0 then return k fi od
%p A374964 end proc:
%p A374964 map(f, [$1..100]); # _Robert Israel_, Jul 30 2024
%t A374964 a[n_] := Module[{k = 1}, While[PowerMod[n, n, n + k] != k, k++]; k]; Array[a, 100] (* _Amiram Eldar_, Jul 26 2024 *)
%o A374964 (Python)
%o A374964 def a(n): return next(k for k in range(1, n+1) if pow(n, n, n+k) == k)
%o A374964 print([a(n) for n in range(1, 94)]) # _Michael S. Branicky_, Jul 26 2024
%o A374964 (Python)
%o A374964 from itertools import count
%o A374964 def A374964(n):
%o A374964     m = n**n+n
%o A374964     return next(d for d in count(1) if not m%(n+d)) # _Chai Wah Wu_, Aug 12 2024
%o A374964 (PARI) a(n) = my(k=1); while (-Mod(n, n+k)^n != n, k++); k; \\ _Michel Marcus_, Jul 26 2024
%Y A374964 Cf. A066068 (n^n+n).
%K A374964 nonn
%O A374964 1,3
%A A374964 _Juri-Stepan Gerasimov_, Jul 25 2024