Let S be the set of {(1,1),(1,−1),(−1,1)}-lattice path which begin at (1,1), do not use the same vertex twice, and never touch either the x-axis or the y-axis. Determine the largest value of n such that every path in S which ends at (n,n) has length at most 50000.

To determine the largest value of n such that every path in S which ends at (n,n) has length at most 50000, we need to understand the nature of these lattice paths and their possible lengths.

First, let's break down the problem and analyze the given set of lattice paths S:

1. The set S consists of lattice paths that begin at (1,1).
2. The set S does not allow revisiting any vertex (point) more than once.
3. The set S does not allow the paths to touch either the x-axis or y-axis.
4. We want to find the largest value of n such that every path in S, ending at (n,n), has a length at most 50000.

Now, let's examine the characteristics of these lattice paths:

1. Each step in the lattice path involves moving either one unit to the right or one unit up.
2. The paths must remain in the first quadrant, meaning the x and y coordinates of each point in the path are positive.

With this information, we can form a strategy to determine the largest value of n satisfying the given conditions.

Let's start by figuring out the length of the longest possible path in S. The longest path would involve taking steps to reach (n,n) in a diagonal manner, following the pattern of moving up and right one unit alternately until reaching (n,n). Each step contributes a length of √2 because of the Pythagorean theorem.

So, the length of the longest path in S, ending at (n,n), can be estimated as:

Length of longest path ≈ (√2) * n

Next, we need to find the largest value of n such that this length is at most 50000:

(√2) * n ≤ 50000

To solve for n, we divide both sides of the inequality by √2:

n ≤ 50000 / (√2)

Now, we can calculate this value:

n ≤ 35355.34

Since n must be an integer, the largest value of n satisfying the conditions is 35355.

Therefore, the largest value of n such that every path in S, ending at (n,n), has a length at most 50000 is 35355.