OFFSET
1,7
COMMENTS
LINKS
Stanislav Sykora, Table of n, a(n) for n = 1..10000
FORMULA
a(n) = n - A046530(n).
Satisfies a(A074243(n))=0.
Satisfies a(n) <= n-3 (residues 0, 1, and n-1 are always present).
a(n) = n - A046530(n). - Robert Israel, Apr 20 2015
EXAMPLE
a(5)=0, because the set {(k^3)%5}, with k=0..4, evaluates to {0,1,3,2,4},
with no missing residue values.
a(7)=4, because the set {(k^3)%7}, with k=0..6, evaluates to
{0,1,1,6,1,6,6}, with missing residue values {2,3,4,5}.
MAPLE
seq(n - nops({seq(a^3 mod n, a=0..n-1)}), n=1..100); # Robert Israel, Apr 20 2015
MATHEMATICA
Table[Length[Complement[Range[n - 1], Union[Mod[Range[n]^3, n]]]], {n, 100}] (* Vincenzo Librandi, Apr 20 2015 *)
PROG
(PARI) nrespowp(n, p) = {my(v=vector(n), d=0);
for(r=0, n-1, v[1+(r^p)%n]+=1);
for(k=1, n, if(v[k]==0, d++));
return(d); }
a(n) = nrespowp(n, 3)
(PARI) g(p, e)=if(p==3, (3^(e+1)+if(e%3==1, 30, if(e%3, 12, 10)))/13, if(p%3==2, (p^(e+2)+if(e%3==1, p^2+p, if(e%3, p^2+1, p+1)))/(p^2+p+1), (p^(e+2)+if(e%3==1, 3*p^2+3*p+2, if(e%3, 3*p^2+2*p+3, 2*p^2+3*p+3)))/3/(p^2+p+1)))
a(n)=my(f=factor(n)); n-prod(i=1, #f~, g(f[i, 1], f[i, 2])) \\ Charles R Greathouse IV, Apr 20 2015
CROSSREFS
KEYWORD
nonn
AUTHOR
Stanislav Sykora, Apr 19 2015
STATUS
approved