TITLE: primorial puzzlement
QUESTION [14 upvotes]: Let $x_n$ be the smallest positive integer which is not a quadratic residue modulo any of the first $n$ odd primes. The question is: is there any bound on how quickly $x_n$ grows as a function of $n?$ Now, since the probability of being a residue modulo any given prime is very close to $1/2,$ by an independence heuristic, $x_n$ should grow roughly like $2^n.$ The problem is that independence clearly does not hold here: if you ask the "opposite" question: how big is $y_n,$ the smallest integer which is a square modulo all of the first $n$ odd primes, the answer is $y_n=1.$ When in doubt, experiment, and computing $\log x_n$ for the $n=2, \dotsc, 20$ gives the graph: In case you wonder, the slope is around $0.8$ (so a bit bigger than $\log 2,$ but $20$ is pretty small, so $x_n \sim 2^n$ seems like a reasonable guess. Does anyone have any nontrivial bounds, even mod "standard conjectures"?
EDIT Noam Elkies points out that a few more terms have been computed (I have gotten up to 24 in the meantime, but 27 is even better :)) The slope of the log is down to $0.76,$ so the conjecture that $\log(x_n) \sim n \log 2$ seems quite reasonable.
Further Edit In fact, if you ponder Noam's comment, you will note that the heuristic will give something like $\log n 2^n$ for the conjectured growth rate...
More Values Using some of joro's ideas, and a little more, we can push the list of values to 40. 
{2, 2, 17, 17, 83, 167, 227, 398, 398, 5297, 64382, 69647, 116387,
214037, 214037, 430022, 5472953, 5472953, 8062073, 8062073, 8062073,
41941577, 86374763, 163520117, 163520117, 231912722, 231912722,
231912722, 545559467, 1728061733, 2832363203, 5638787822, 5638787822, 
6154772762, 6154772762, 7012246247, 7012246247, 7012246247, 6571091781638,    7218195919667}

REPLY [7 votes]: I'll try to unify all the previous answers (of GH from MO, Will Sawin and Hurkyl) and also indicate unconditional results on this problem.   It turns out 
 that one can get a surprisingly decent unconditional upper bound here, which is something I hadn't 
 appreciated fully previously.  As noted  in Hurkyl's answer above, a unifying problem is the following:  Given a non-trivial subgroup $H$ of $({\Bbb Z}/q{\Bbb Z})^*$ with index $h$, bound (i) the least prime $p$ lying in a given coset of $H$, or (ii) the least integer $n$ lying in a given coset of $H$.  Obviously the second problem is easier than the first, and as noted in Hurkyl's answer Theorem 1.4 of Lamzouri, Li and Soundararajan gives a good bound on GRH for the first problem: the least prime is essentially bounded by $((h-1) \log q)^2$  (see the precise form) and this result unifies both the least quadratic non-residue problem and also the least prime in an arithmetic progression problem.   
Unconditionally, for problem (i), by Linnik's theorem on the least prime in an arithmetic progression we always have a bound of $\ll q^{L}$, for an absolute constant $L$, and the current record here is that $L=5$ is permissible by Xylouris.  When $h$ is small, then a somewhat better bound can be given:  for $h=2$ (the case of the least prime that splits, or the least prime that is inert in a quadratic field) this is classical and well known, the case of split primes being harder and the bound here is $q^{\frac 14+\epsilon}$ (using Burgess for character sums and Siegel's ineffective bound for $L(1,\chi)$).   For larger, but still bounded $h$, the matter was treated by Elliott  in the context of the least prime $h$-th power residue, and he obtained the bound $q^{(h-1)/4+\epsilon}$.  Of course for large $h$ (i.e. $h\ge 22$) this becomes inferior to Linnik's theorem.  A recent paper of Pollack addresses a somewhat more general version of this question, and obtains the bound $\ll q^{(h-1)/4+\epsilon}$.  
Now for unconditional results towards the easier problem (ii).  Assume that $h \le q^{\epsilon}$ and express the 
condition of belonging to a coset of $H$ in terms of the characters that are trivial on $H$ (see the paper of Lamzouri, Li and Soundararajan for details).   Then use the Burgess bounds on the character sums that arise.  This argument gives that the least integer $n$ in any given coset is $\ll q^{\frac 14+\epsilon}$.  This is a (modest) improvement over the trivial bound of $q$.   For a general modulus $q$ the Burgess bound gives the best known result on this problem.  However, for moduli $q$ that are very smooth (and this will be important for the present problem) one can obtain a better result by a $q$-van der Corput argument due to Graham and Ringrose (following Heath-Brown).   From the Graham-Ringrose argument (see either the original paper, or Corollary 12.14 of Iwaniec and Kowalski, or estimate (4.1) and Lemma 4.2 from Granville and Soundararajan), one can show that if all the prime factors of $q$ are bounded by $q^{o(1)}$ then the least integer in any prescribed coset is $\ll q^{\epsilon}$ 
for any fixed $\epsilon >0$. Naturally there is a connection between how small $\epsilon$ can be and the smoothness of $q$, and one can find uniform bounds in the results referenced above. 
Returning to the problem at hand, if $p_1, \ldots, p_n$ are the first $n$ odd primes, and we 
 set $q=p_1\cdots p_n = n^{(1+o(1))n}$ and $H$ to be the subgroup of squares mod $q$ (which has index $2^n$) 
 then on GRH we can find a prime $p \ll 4^n (n\log n)^2$ lying in any given coset of $H$.  That is given any choice of signs $\epsilon_j = \pm 1$, there is a prime $p\ll 4^n (n\log n)^2$ with $(\frac{p}{p_j}) = \epsilon_j$ (in particular we can take all $\epsilon_j=-1$ as asked for in the problem).   This was noted in Hurkyl's answer.  Note now 
 that unconditionally by the Burgess estimate we may find a number $N \ll n^{n(1/4+\epsilon)}$ with $(\frac{N}{p_j}) =\epsilon_j$.  But note that we are dealing now with a modulus $q$ of size $n^n$ all of whose prime factors are 
 of size $\ll n\log n$; in other words, $q$ is very smooth indeed and Graham-Ringrose applies and gives an unconditional upper bound of $n^{\epsilon n}$.  In fact, by keeping track of uniformity, one gets an unconditional upper bound of $n^{c n/\log \log n}$ for some positive constant $c$. 
Now consider lower bounds in the problem.  Here we must make use of the fact that we are looking for the smallest number $N$ with $(\frac{N}{p_j})=-1$ for all $j\le n$ -- for a random choice of signs $\epsilon_j$ there may of course 
 be a very small number $N$ (just pick the number $N$ and see what the signs are!).  Note that $N$ or $4N$ would be a discriminant, and we are asking for a quadratic character $\pmod {N}$ or $\pmod {4N}$ taking value $-1$ on the first $n$ small primes.  This fits our framework by taking $q=4N$, and $H$ to be the subgroup of index $2$ on which this character  (say $\chi$) is trivial.  On GRH we know that there is an odd prime $\ell \le (1+o(1)) (\log N)^2$ with $\chi(\ell) =1$, and so we must have $(\log N)^2 \ge (1+o(1)) n\log n$ or 
 $$ 
 N\ge \exp((1+o(1)) \sqrt{n\log n}).
 $$ 
 This is the conditional bound mentioned in Will Sawin's answer, and what I indicated in my comment there.
 Unconditionally, the Burgess bound and Siegel's theorem argument (for problem (i)) gives that there is a prime $\ell \le N^{\frac 14+\epsilon}$ with $\chi(\ell)=1$, and  so $N\ge n^{4+o(1)}$.  
To summarize, on GRH we know that the answer lies between 
 $$ 
 \exp((1+o(1)) \sqrt{n\log n} ) \text{  and  } \ll 4^n (n\log n)^2 
 $$ 
 and unconditionally we know that it is between 
 $$ 
 n^{4+o(1)} \text{   and   } \ll n^{cn/\log \log n}.
 $$ 
 The probabilistic conjecture that the answer should be somewhere near $2^n$ seems reasonable.