OFFSET
1,2
COMMENTS
For any k > 0, let r(j) = k mod prime(j) for all j > 0, and let f(k) be the number such that r(1), r(2), ..., r(f(k)) are all distinct, but r(f(k)+1) = r(j) for some j <= f(k). Then a(n) is the smallest positive number k such that f(k) = n.
The definition of A279073 is the same as that of this sequence except that A279073 does not include the requirement that the residues modulo the first n+1 primes not be all different. As a result, A279073 is strictly nondecreasing, whereas this sequence is not; A279073(n) = min_{i>=n} a(i). (See Example section.)
LINKS
Jon E. Schoenfield, Table of n, a(n) for n = 1..78
EXAMPLE
For n=6, the first n+1 primes are {2, 3, 5, 7, 11, 13, 17}, and at k=87, we get k mod {2, 3, 5, 7, 11, 13, 17} = {1, 0, 2, 3, 10, 9, 2}, of which the first n=6 residues are all different, but the 7th residue is a repeat of one of the earlier ones (i.e., 87 mod 17 = 87 mod 5). Thus, f(87) = 6, and since there exists no k < 87 for which f(k) = 6, we have a(6) = 87.
For n=13, 129 mod {each of the first n+1 primes} gives {1, 0, 4, 3, 8, 12, 10, 15, 14, 13, 5, 18, 6, 0}, of which the first n=13 residues are all different, but 129 mod prime(14) = 129 mod prime(2). Thus, f(129) = 13, and since there exists no k < 129 for which f(k) = 13, we have a(13) = 129. (Note that a(13) < a(n) for n=8..12; thus, since sequence A279073 does not have the requirement that the residue modulo the (n+1)-st prime be a repeat of one of the earlier residues, A279073(n)=129 not only for n=13, but also for n=8..12.)
MATHEMATICA
f[k_, m_]:=Mod[k, #]&/@Prime[Range[m]]; f[n_]:=Module[{k=1},
While[Or[Sort[f[k, n]]!=Union[f[k, n]], Sort[f[k, n+1]]==Union[f[k, n+1]]], k++]; k];
f/@Range[25] (* Ivan N. Ianakiev, Jan 17 2017 *)
PROG
(PARI) a(n) = {k = 1; ok = 0; while (!ok, vp = vector(n, j, k % prime(j)); vpo = vecsort(vp, , 8); if ((#vp == #vpo) && vecsearch(vpo, k % prime(n+1)), ok = 1, k++); ); k; } \\ Michel Marcus, Jan 22 2017
CROSSREFS
KEYWORD
nonn
AUTHOR
Jon E. Schoenfield, Jan 15 2017
STATUS
approved