A279074 Smallest positive number whose residues modulo the first n primes are all different but whose residues modulo the first n+1 primes are not all different.
1, 2, 3, 5, 8, 87, 116, 164, 203, 413, 712, 1478, 129, 472, 3033, 356, 6509, 202, 6753, 7769, 33724, 14614, 16574, 43844, 33164, 70988, 59405, 30777, 90878, 437408, 239644, 158944, 1088128, 359433, 171155, 390155, 99483, 680384, 845662, 1719404, 5597092
Offset: 1
Keywords
Examples
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.)
Links
- Jon E. Schoenfield, Table of n, a(n) for n = 1..78
Crossrefs
Cf. A279073.
Programs
-
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 *)
-
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
Comments