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

A196777 Sum (mod n) of the distinct residues of x^n (mod n), x=0..n-1.

Original entry on oeis.org

0, 1, 0, 1, 0, 2, 0, 1, 0, 5, 0, 2, 0, 0, 0, 1, 0, 2, 0, 2, 0, 0, 0, 2, 0, 13, 0, 0, 0, 0, 0, 1, 0, 17, 0, 2, 0, 0, 0, 2, 0, 4, 0, 22, 0, 0, 0, 2, 0, 25, 0, 0, 0, 2, 0, 28, 0, 29, 0, 4, 0, 0, 0, 1, 0, 0, 0, 17, 0, 0, 0, 2, 0, 37, 0, 38, 0, 0, 0, 2, 0, 41, 0, 4
Offset: 1

Views

Author

Michel Lagneau, Oct 06 2011

Keywords

Comments

if n = 2^m, a(n) = 1 ;
if n is odd, a(n) = 0 ;
if a(n) is prime > 2, then a(n) = n/2, for example a(10) = a(2*5) = 5 ;
There exists composite numbers k such that a(k)=k/2, for example a(44)= a(2*22)=22.

Examples

			a(10) = 5 because the residues (mod 10) of x^10 are 0, 1, 4, 5, 6, 9 and the sum 25 ==5 (mod 10).
		

Crossrefs

Programs

  • Maple
    with(numtheory):sumDistRes := proc(n) local re, x, r ; re := {} ; for x from  0 to n-1 do re := re union { modp(x^n, n) } ; end do: add(r, r=re) ; end : for  n from 1 to 150 do ; z:=irem(sumDistRes(n),n) ;printf("%d, ", z);end do: #
  • PARI
    A196777(n) = (vecsum(Set(vector(n, k, lift(Mod(k-1, n)^n))))%n); \\ (After code in A195812) - Antti Karttunen, May 19 2021

Formula

a(n) = A195812(n) (mod n).

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).

A196730 Numbers m such that the sum of the distinct residues of x^m (mod m) is a perfect square, x=0..m-1.

Original entry on oeis.org

1, 2, 4, 8, 9, 10, 16, 26, 32, 34, 58, 64, 74, 81, 82, 84, 106, 122, 128, 146, 178, 194, 196, 202, 218, 226, 250, 256, 274, 298, 314, 346, 361, 362, 386, 394, 441, 458, 466, 480, 482, 512, 514, 538, 554, 562, 586, 626, 634, 674, 676, 698, 706, 722, 729, 746
Offset: 1

Views

Author

Michel Lagneau, Oct 05 2011

Keywords

Comments

m such that A195812(m) is a perfect square.

Examples

			a(8) = 26 because x^26 == > 0, 1, 3, 4, 9, 10, 12, 13, 14, 16, 17, 22, 23, 25  (mod 26), and the sum  = 169 = 13^2.
		

Crossrefs

Programs

  • Maple
    sumSquares := proc(n)
    local re, x, r ;
    re := {} ;
    for x from 0 to n-1 do
    re := re union { modp(x^n, n) } ;
    end do:
    add(r, r=re) ;
    end proc:
    for n from 1 to 750 do
    z:= sqrt(sumSquares(n));
    if z=floor(z) then
    printf("%d, ", n);
    end if;
    end do: #
Showing 1-4 of 4 results.