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.

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

Original entry on oeis.org

0, 1, 3, 1, 10, 8, 21, 1, 9, 25, 55, 14, 78, 42, 105, 1, 136, 20, 171, 22, 84, 110, 253, 26, 50, 169, 27, 84, 406, 150, 465, 1, 528, 289, 595, 38, 666, 342, 273, 42, 820, 130, 903, 198, 315, 460, 1081, 50, 147, 125, 1275, 156, 1378, 56, 385, 140, 570, 841
Offset: 1

Views

Author

Michel Lagneau, Oct 05 2011

Keywords

Comments

a(n) has the following properties :
If n is a power of 2 then a(n)= 1 ;
Except for n = 9 where a(9)=9, if a(n) is the square of a prime p, the sequence shows that n is of the form n = 2p.
The numbers m such that a(m) are square are : 1, 2, 4, 8, 9, 10, 16, 26, 32, 34, 58, 64, 74, 81, ...

Examples

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

Crossrefs

Programs

  • Maple
    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 proc:
    for n from 1 to 100 do
              printf("%d, ", sumDistRes(n));
    end do: # (Program of R. J. Mathar - see A196546)
  • Mathematica
    Table[{m,Total[Union[Table[PowerMod[x,m,m],{x,m-1}]]]},{m,1000}] (* Zak Seidov, Oct 06 2011 *)
  • PARI
    a(n) = vecsum(Set(vector(n, k, lift(Mod(k-1,n)^n)))); \\ Michel Marcus, Jun 01 2015