This is kind of old, so please let me know if you are no longer interested in the problem.
Graphically, your problem is: find the intersections of the graph of $y=x$ with the graph of the tangent function.
As seen on the graph plotted by ResidentBiscuit, the tangent function consists of infinitely many strips of width \pi. Therefore the graph of $y=x$ will have infinitely many intersections with the graph of \tan x, exactly one for each interval of the form ( \pi(n-1/2) , \pi(n+1/2) ).
Since you will have infinitely many solutions, you have to specify your favorite interval where you want to find a solution. Or perhaps you have an additional input of specifying in which interval you are looking for a solution?
As far as the solution is concerned: I would **definitely** use Newton's method. Below are the slides with which I teach Newton's method. It would be dead easy to implement. The function with respect to which you will be applying it is
f(x)= \tan x - x - y
(y is a constant here, input by the user).
To the formulas for Newton's method, you will simply need f'(x) = 1/(\cos x)^2 -1 = (\tan x)^2. The vertical strip in which you end up finding your solution will be determined by your starting point. Newton's method in this context should be no more than 5 lines of code ...
https://s3.amazonaws.com/piazza-resources/hqw035yoi7opm/htvp8t121nz5rx/Lecture_18_Newtons_Method_SKIPPED_WILL_NOT_BE_TESTED_2014_Spring_Calc_I.pdf?AWSAccessKeyId=AKIAJKOQYKAYOBKKVTKQ&Expires=1417170389&Signature=TDHbh8%2FPZL%2BkdfJTRGmybjPrNkk%3D
Hope you still have any use for my post, if not, cheers!