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.

A317357 a(n) is the smallest composite k > n such that 1^(k-1) + 2^(k-1) + ... + n^(k-1) == n (mod k).

This page as a plain text file.
%I A317357 #34 Aug 15 2018 22:36:08
%S A317357 4,341,473,6,10,133,497,14,12,15,15,16,18,143,35,20,32,51,57,38,28,77,
%T A317357 253,36,30,65,39,36,58,115,155,62,36,187,119,40,74,57,247,52,80,287,
%U A317357 2051,86,55,69,69,94,54,175,85,65,65,159,69,70,64,551,1711,72
%N A317357 a(n) is the smallest composite k > n such that 1^(k-1) + 2^(k-1) + ... + n^(k-1) == n (mod k).
%C A317357 According to the Agoh-Giuga conjecture, a(n) > n+1.
%C A317357 a(n) > A151800(n) for all n < 33.
%C A317357 a(n) <= A271221(n) for n > 1.
%H A317357 Chai Wah Wu, <a href="/A317357/b317357.txt">Table of n, a(n) for n = 1..9661</a>
%H A317357 Wikipedia, <a href="https://en.wikipedia.org/wiki/Agoh%E2%80%93Giuga_conjecture">Agoh-Giuga conjecture</a>
%t A317357 a[n_] := Block[{k = n+1}, While[PrimeQ[k] || Mod[Sum[PowerMod[j, k-1, k], {j, n}], k] != n, k++]; k]; Array[a, 60] (* _Giovanni Resta_, Jul 26 2018 *)
%o A317357 (PARI) a(n) = forcomposite(k=n+1,, if (sum(j=1,n, Mod(j,k)^(k-1)) == n, return (k));); \\ _Michel Marcus_, Jul 26 2018
%o A317357 (Python)
%o A317357 from sympy import isprime
%o A317357 def g(n,p,q): # compute (-n + sum_{k=1,n} k^p)  mod q
%o A317357     c = (-n) % q
%o A317357     for k in range(1,n+1):
%o A317357         c = (c+pow(k,p,q)) % q
%o A317357     return c
%o A317357 def A317357(n):
%o A317357     k = n+1
%o A317357     while isprime(k) or g(n,k-1,k):
%o A317357         k += 1
%o A317357     return k # _Chai Wah Wu_, Jul 31 2018
%Y A317357 Cf. A151800, A271221, A317058, A317358.
%K A317357 nonn
%O A317357 1,1
%A A317357 _Thomas Ordowski_, Jul 26 2018
%E A317357 More terms from _Giovanni Resta_, Jul 26 2018