OFFSET
2,2
MAPLE
with(numtheory): m:=3: for n from 2 to 100 do S:={}: for a from 1 to n-1 do if gcd(a, n)=1 and gcd(cyclotomic(m, a), n)=1 then S:={op(S), a}: fi: od: print(sum(op(i, S), i=1..nops(S)) mod n): od:
MATHEMATICA
Table[Mod[Total@ Select[Range[n - 1], CoprimeQ[#, n] && CoprimeQ[Cyclotomic[3, #], n] &], n], {n, 79}] (* Michael De Vlieger, Jul 29 2017 *)
PROG
(PARI) a(n) = sum(k=0, n-1, k*((gcd(n, k)==1) && (gcd(n, polcyclo(3, k))==1))) % n; \\ Michel Marcus, Jul 29 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Michael Mueller, Jordan Lenchitz, Tristan Phillips, Madison Wellen, Eric Jovinelly, Joshua Harrington, Jul 27 2017
STATUS
approved