TITLE: Is this a known number-theoretic function?
QUESTION [16 upvotes]: I am wondering if there is a name for a certain function and/or a literature concerning it?
For $x=1,2,3,4,5,6,\ldots$, let $f(x)$ be the length of the shortest sequence of consecutive integers including $x$ for which all prime numbers $\le\sqrt{x}$ occur as factors of numbers in the sequence.
For example, consider $f(1350)$.  We know that $36^2<1350<37^2$.  In the sequence from $1349=19\cdot71$ through $1364=2\cdot2\cdot11\cdot31$, one finds the first $11$ prime numbers $2,3,5,7,11,13,17,19,23,29,31$, and the next is $37$, which is bigger than the square root of all the numbers in $\{1349,\ldots,1364\}$.  Hence $f(1350)=16$.
$$
\begin{array}{crlc}
\text{count} & & \text{factorization} & \text{small primes seen so far} \\
\hline
1 & 1349 & = 19\cdot71 & 19 \\
2 & 1350 & = 2\cdot3\cdot3\cdot3\cdot5\cdot5 & 2,3,5,19 \\
3 & 1351 & = 7\cdot191 & 2,3,5,7,19 \\
4 & 1352 & = 2\cdot2\cdot2\cdot13\cdot13 & 2,3,5,7,13,19 \\
5 & 1353 & = 3\cdot11\cdot41 & 2,3,5,7,11,13,19 \\
6 & 1354 & = 2\cdot677 & \text{ditto (no new ones this time)} \\
7 & 1355 & = 5\cdot271 & \text{ditto} \\
8 & 1356 & = 2\cdot2\cdot3\cdot113 & \text{ditto} \\
9 & 1357 & = 23\cdot59 & 2,3,5,7,11,13,19,23 \\
10 & 1358 & = 2\cdot7\cdot97 & \text{ditto} \\
11 & 1359 & = 3\cdot3\cdot151 & \text{ditto} \\
12 & 1360 & =2\cdot2\cdot2\cdot2\cdot5\cdot17 & 2,3,5,7,11,13,17,19,23 \\
13 & 1361 & = 1361 & \text{ditto} \\
14 & 1362 & = 2\cdot3\cdot227 & \text{ditto} \\
15 & 1363 & = 29\cdot27 & 2,3,5,7,11,13,17,19,23,29 \\
16 & 1364 & = 2\cdot2\cdot11\cdot31 & 2,3,5,7,11,13,17,19,23,29,31
\end{array}
$$
The "$\text{count}$" is $16$, so that is $f(1350)$.  That's how long the sequence had to be to get all $11$ of the "small" primes, i.e. primes no bigger than $\sqrt{1350}$.
A reason to care about this is that if one wants to factor an integer in this range, one looks at its distances from each of those first $11$ primes to decide whether it's divisible by any of them, and if not, then it's prime. So one need not search beyond that sequence.
I lean toward taking $f(1)$, $f(2)$, and $f(3)$ to be $0$ since no prime numbers are $\le$ the square roots of those numbers.  But that would require a slight rephrasing of the definition of $f$, and I'm not immediately sure how best to do that.
So here's my question: Is this a known function?  Does it have a standard name?  Are the theorems of interest concerning it?  What books give an account of it?  (Confession: I haven't yet checked OEIS for it.)

REPLY [4 votes]: I want to give a remark for the interesting properties section.
But first-of-all a (non-effective) formula: for all primes $p\leq \sqrt{x}$ let $$\begin{eqnarray}\delta_1(p) &=& -( x \bmod p), \\ \delta_2(p)&=&p+\delta_1(p). \end{eqnarray}$$ These are the distances to the multiples of $p$ which are nearest to $x$. Then

$$f(x) = \min_{a,b \in \Bbb Z}\{b-a+1 \mid \forall p:a\leq\delta_1(p) \text{ or } \delta_2(p)\leq b\}$$

because $x+a$ and $x-b$ are bounds for the minimal sequence. 

This shows that the sequence $(f(n))_{n \in \Bbb N}$ has the property
  $|f(n)-f(n+1)|\leq 1$  $\forall n$.

Proof: Let $n  \in \Bbb N$ and select $a(n), b(n)$ minimizing the equation above (the choice is not unique in general), that is $f(n)$ is determined by $a(n),b(n)$. There are two cases: 

There is no prime $\sqrt{n} < p \leq \sqrt{n+1}$: Then if $n+1 \leq b(n)$ the two bounds are already of the required form (but not necessarily minimal) and if $n+1>b(n)$ choose $b(n)+1$ as a bound. This shows $f(n+1)-f(n)\leq 1$. The same consideration also works the other way round (with $a$ instead of $b$) showing $f(n)-f(n-1)\leq 1$.
There is a prime $\sqrt{n} < p \leq \sqrt{n+1}$. Then $p^2 = n+1$, hence $p \mid n+1$ and we don't have to care about divisibility by $p$ for our bounds. So we can choose bounds as chosen in the first part of the proof.

This suggests to investigate the sequence $(f(n+1)-f(n))_{n\in \Bbb N}$ instead of $f$.