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.

Showing 1-1 of 1 results.

A367689 Smallest prime number p such that x^n + y^n mod p does not take all values on Z/pZ.

Original entry on oeis.org

7, 5, 11, 7, 29, 5, 7, 11, 23, 5, 53, 29, 7, 5, 103, 7, 191, 5, 7, 23, 47, 5, 11, 53, 7, 5, 59, 7, 311, 5, 7, 103, 11, 5, 149, 191, 7, 5, 83, 7, 173, 5, 7, 47, 283, 5, 29, 11, 7, 5, 107, 7, 11, 5, 7, 59, 709, 5, 367, 311, 7, 5, 11, 7, 269, 5, 7, 11, 569, 5, 293, 149, 7, 5, 23, 7, 317, 5
Offset: 3

Views

Author

Robin Visser, Nov 26 2023

Keywords

Comments

If there exists some prime p > 3 such that p-1 divides n, then x^n (mod p) is either 0 or 1 for all integers x, therefore giving an upper bound of a(n) <= p.

Examples

			For n = 3, x^3 + y^3 attains all values on Z/2Z, Z/3Z, and Z/5Z, but x^3 + y^3 == 3 (mod 7) has no solution, so a(3) = 7.
For n = 4, x^4 + y^4 attains all values on Z/2Z and Z/3Z, but x^4 + y^4 == 3 (mod 5) has no solution, so a(4) = 5.
		

Crossrefs

Programs

  • PARI
    a(n) = my(p=2); while (#setbinop((x,y)->Mod(x,p)^n+Mod(y,p)^n, [0..p-1]) == p, p=nextprime(p+1)); p; \\ Michel Marcus, Nov 27 2023
    
  • Python
    from itertools import combinations_with_replacement
    from sympy import sieve
    def A367689(n):
        for p in sieve.primerange(n**4+1):
            s = set()
            for k in combinations_with_replacement({pow(x,n,p) for x in range(p)},2):
                s.add(sum(k)%p)
                if len(s) == p:
                    break
            else:
                return p # Chai Wah Wu, Nov 27 2023
  • Sage
    def a(n):
        for p in Primes():
            all_values = set()
            for x in range(p):
                for y in range(p):
                    all_values.add((x^n+y^n)%p)
            if len(all_values) < p: return p
    
Showing 1-1 of 1 results.