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-3 of 3 results.

A202035 Greatest prime residue of x^n (mod n) for x=0..n-1, or 0 if no such prime exists.

Original entry on oeis.org

0, 0, 2, 0, 3, 3, 5, 0, 0, 5, 7, 0, 11, 11, 13, 0, 13, 0, 17, 5, 13, 11, 19, 0, 7, 23, 0, 0, 23, 19, 29, 0, 31, 19, 31, 0, 31, 23, 31, 0, 37, 7, 41, 37, 37, 41, 43, 0, 31, 0, 47, 29, 47, 0, 43, 0, 37, 53, 53, 0, 59, 59, 0, 0, 61, 37, 61, 17, 67, 29, 67, 0, 71
Offset: 1

Views

Author

Michel Lagneau, Dec 09 2011

Keywords

Examples

			a(7) = 3  because  k^7 ==0, 1, 2, 3, 4, 5, 6 (mod 7) => 5 is the greatest prime.
		

Crossrefs

Programs

  • Maple
    for n from 1 to 100 do: W:={}:for k from 0 to n-1 do:z:= irem(k^n,n): if type(z,prime)=true then W:=W union {z}:else fi:od: x:=nops(W): if x<>0 then printf(`%d, `,W[x]): else printf(`%d, `,0):fi: od:

A202036 Smallest prime residue of x^n (mod n) for x=0..n-1, or 0 if no such prime exists.

Original entry on oeis.org

0, 0, 2, 0, 2, 3, 2, 0, 0, 5, 2, 0, 2, 2, 2, 0, 2, 0, 2, 5, 7, 3, 2, 0, 7, 3, 0, 0, 2, 19, 2, 0, 2, 2, 2, 0, 2, 5, 5, 0, 2, 7, 2, 5, 17, 2, 2, 0, 19, 0, 2, 13, 2, 0, 11, 0, 7, 5, 2, 0, 2, 2, 0, 0, 2, 3, 2, 13, 2, 11, 2, 0, 2, 3, 7, 5, 2, 13, 2, 0, 0, 2, 2, 0
Offset: 1

Views

Author

Michel Lagneau, Dec 09 2011

Keywords

Examples

			a(7) = 2 because k^7 == 0, 1, 2, 3, 4, 5, 6 (mod 7) => 2 is the smallest prime.
		

Crossrefs

Programs

  • Maple
    for n from 1 to 100 do: W:={}:for k from 0 to n-1 do:z:= irem(k^n,n): if type(z,prime)=true then W:=W union {z}:else fi:od: x:=nops(W): if x<>0 then printf(`%d, `,W[1]): else printf(`%d, `,0):fi: od:
  • Mathematica
    Table[SelectFirst[Sort[PowerMod[Range[n-1],n,n]],PrimeQ],{n,90}]/.Missing["NotFound"]->0 (* Harvey P. Dale, May 01 2023 *)
  • PARI
    A202036(n) = { my(z,y=n); for(x=1,n-1,z = lift(Mod(x,n)^n); if(isprime(z), y = min(z,y))); if(y==n,0,y); }; \\ - Antti Karttunen, May 19 2021

A340806 a(n) = Sum_{k=1..n-1} (k^n mod n).

Original entry on oeis.org

0, 1, 3, 2, 10, 13, 21, 4, 27, 45, 55, 38, 78, 77, 105, 8, 136, 93, 171, 146, 210, 209, 253, 172, 250, 325, 243, 294, 406, 365, 465, 16, 528, 561, 595, 402, 666, 665, 741, 372, 820, 673, 903, 726, 945, 897, 1081, 536, 1029, 1125, 1275, 1170, 1378, 765, 1485
Offset: 1

Views

Author

Sebastian Karlsson, Jan 22 2021

Keywords

Crossrefs

Programs

  • Maple
    a:= n-> add(k&^n mod n, k=1..n-1):
    seq(a(n), n=1..55);  # Alois P. Heinz, Feb 13 2021
  • PARI
    a(n) = sum(k=1, n-1, lift(Mod(k, n)^n)); \\ Michel Marcus, Jan 22 2021
  • Python
    def a(n):
        return sum([pow(k,n,n) for k in range(1, n)])
    for n in range(1, 56):
        print(a(n), end=', ')
    

Formula

a(n) = n*A010848(n)/2, if n is odd.
a(n) = n*(n-1)/2, if n is both odd and squarefree.
a(p^e) = (1/2)*(p-1)*p^(2*e-1), if p is an odd prime.
a(2^e) = 2^(e-1).
Showing 1-3 of 3 results.