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.

A331810 Smallest integer x such that prime(n) divides 1 + x + x^2 + ... + x^(q-1) where q = A023503(n), or 0 if no such x exists.

Original entry on oeis.org

2, 4, 2, 3, 3, 16, 7, 2, 7, 2, 10, 10, 4, 2, 10, 3, 9, 9, 20, 8, 8, 3, 2, 35, 36, 8, 3, 45, 16, 2, 39, 16, 6, 5, 8, 14, 58, 2, 6, 3, 42, 5, 84, 36, 18, 58, 2, 3, 16, 2, 6, 87, 20, 256, 2, 5, 10, 16, 59, 4, 16, 9, 7, 27, 10, 74, 8, 3, 31, 22, 2, 7, 12, 86, 2, 5
Offset: 2

Views

Author

Michel Lagneau, Jan 27 2020

Keywords

Comments

Conjecture: every integer > 1 is in the sequence.
Theorem: Let p and q be prime numbers for which there exists an integer x such that p divides 1 + x + x^2 + ... + x^(q-1). Then p == 1 (mod q) or p = q.

Examples

			a(8) = 7 because prime(8) = 19 divides 1 + 7^1 + 7^2 = 57 = 3*19, where q = 3 = A023503(8).
a(9) = 2 because prime(9) = 23 divides 1 + 2^1 + 2^2 + 2^3 + 2^4 + 2^5 + 2^6 + 2^7 + 2^8 + 2^9 + 2^10  = 2047 = 23*89, where q = 11 = A023503(9).
		

Crossrefs

Cf. A023503 (greatest prime divisor of prime(n) - 1).

Programs

  • Maple
    with(numtheory):nn:=100:
    for n from 2 to nn do:
    p:=ithprime(n):d:=factorset(p-1):n0:=nops(d):q:=d[n0]:ii:=0:
       for x from 1 to 10^5 while(ii=0) do:
        s:=sum('x^(i-1)', 'i'=1..q):
         if irem(s,p)=0 then
          ii:=1:printf(`%d, `,x):
         else fi:
         od:
        od:
  • Mathematica
    Array[Block[{k = 2}, While[Mod[Total[k^#2 ], #1] != 0, k++]; k ] & @@ {Prime@ #, Range[0, FactorInteger[Prime@ # - 1][[-1, 1]] - 1 ]} &, 76, 2] (* Michael De Vlieger, Jan 27 2020 *)
  • PARI
    a(n) = {my(p=prime(n), q=vecmax(factor(p-1)[,1]), x=1); while (sum(k=0, q-1, x^k) % p, x++); x;} \\ Michel Marcus, Jan 30 2020