cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

Showing 1-3 of 3 results.

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.

Original entry on oeis.org

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

Views

Author

Jon E. Schoenfield, Jan 15 2017

Keywords

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.)

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.)
		

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

A279086 Number of distinct residues n mod p encountered before the first repeated residue as p runs through the primes.

Original entry on oeis.org

1, 2, 3, 3, 4, 1, 1, 5, 5, 2, 2, 1, 1, 3, 2, 2, 2, 1, 1, 2, 2, 3, 3, 1, 1, 5, 5, 3, 3, 1, 1, 2, 4, 4, 3, 1, 1, 3, 3, 2, 2, 1, 1, 3, 2, 2, 2, 1, 1, 2, 2, 5, 5, 1, 1, 3, 3, 4, 4, 1, 1, 2, 3, 3, 3, 1, 1, 4, 5, 2, 2, 1, 1, 3, 2, 2, 2, 1, 1, 2, 2, 4, 4, 1, 1, 3, 6
Offset: 1

Views

Author

Jon E. Schoenfield, Jan 15 2017

Keywords

Comments

A279073(j) = min_{n : a(n) >= j}.
A279074(j) = min_{n : a(n) = j}.

Examples

			For n=11, the residues n mod prime(j) for j>=1 begin with 11 mod 2 = 1, 11 mod 3 = 2, and 11 mod 5 = 1; the first 2 residues are distinct, but the 3rd is a repeat of an earlier one, so a(11) = 2.
For n=87, the residues n mod prime(j) for j>=1 begin with 87 mod 2 = 1, 87 mod 3 = 0, 87 mod 5 = 2, 87 mod 7 = 3, 87 mod 11 = 10, 87 mod 13 = 9, 87 mod 17 = 2; the first 6 residues are all distinct, but the 7th is a repeat (87 mod 17 = 87 mod 5 = 2), so a(87) = 6.
		

Crossrefs

A309090 a(n) is the least x such that x^2 mod prime(i), i=1..n, are all distinct.

Original entry on oeis.org

1, 2, 2, 3, 3, 172, 213, 213, 333, 333, 1228, 1438, 2152, 3832, 3832, 3832, 5792, 22732, 22732, 37342, 37342, 37342, 37342, 37342, 545408, 629247, 629247, 629247, 629247, 629247, 629247, 629247, 629247, 1423713, 8136838, 8136838
Offset: 1

Views

Author

Robert Israel, Jul 11 2019

Keywords

Comments

There are more than n squares mod prime(n+1); therefore given a(n)=k we can choose a square r mod prime(n+1) that is not a(n)^2 mod prime(i) for i <= n, and using Chinese Remainder Theorem find x such that x == a(n) (mod prime(i)) for i <= n and x^2 == r (mod prime(n+1)), and then a(n+1) <= x. In particular a(n) exists for all n.

Examples

			a(5) = 3 because 3^2 mod 2 = 1, 3^2 mod 3 = 0, 3^2 mod 5 = 4, 3^2 mod 7 = 2 and 3^2 mod 11 = 9 are all distinct, while this is not the case for 1^2 or 2^2 (e.g. 2^2 mod 5 = 2^2 mod 7 = 4).
		

Crossrefs

Cf. A279073.

Programs

  • Maple
    P:= NULL:
    v:= 1:
    for n from 1 to 35 do
      P:= P ,ithprime(n);
      for k from v do
        if nops({seq(k^2 mod P[i],i=1..n)}) = n then
          v:= k;
          A[n]:= k;
          break
        fi
      od
    od:
    seq(A[n],n=1..35);
  • PARI
    isok(k, n) = my(v=vector(n, j, lift(Mod(k, j)^2))); #v == #Set(v);
    a(n) = {my(k=1); while(!isok(k, n), k++); k;} \\ Michel Marcus, Jul 12 2019
Showing 1-3 of 3 results.