OFFSET
1,3
LINKS
Michel Marcus, Table of n, a(n) for n = 1..1000
FORMULA
See program below.
a(n) = n + 1 - Sum_{k=1..n-1} ( floor((k-1)!^(n-1)/(n-k+1))-floor(((k-1)!^(n-1)-1)/(n-k+1)) ). - Anthony Browne, May 27 2016
EXAMPLE
n=25: Primes are (2,3,5,7,11,13,17,19,23), remainders are (1,1,0,4,3,12,8,6,2), distinct remainders are {0,1,2,3,4,6,8,12} which has 8 members, so a(25) = 8.
MATHEMATICA
Table[Length[Union[Table[Mod[w, Prime[j]], {j, 1, PrimePi[w]}]]], {w, 1, 256}]
Table[Length[Union[Mod[n, Prime[Range[PrimePi[n]]]]]], {n, 100}] (* Harvey P. Dale, Jul 04 2021 *)
PROG
(PARI) a(n) = #Set(vector(primepi(n), k, n % prime(k))); \\ Michel Marcus, May 28 2016
(PARI) a(n) = #Set(apply(p->n%p, primes([2, n]))) \\ Charles R Greathouse IV, Jun 17 2016
CROSSREFS
KEYWORD
nonn
AUTHOR
Labos Elemer, Aug 02 2002
STATUS
approved