A345404 a(n) is the smallest positive integer k such that |tan(k) - round(tan(k))| is smaller than 10^(-n), but greater than 10^(-n-1).
11, 22, 1120, 355, 14817, 286602, 5117932, 144316263, 167004362, 8984683957
Offset: 1
Examples
For n=3, a(n)=1120, because 1120 is the smallest positive integer such that |tan(1120) - round(tan(1120))| = 0.0008709... < 10^(-3) and 0.0008709... > 10^(-4).
Programs
-
Maple
n := 1: for i from 2 to 10^10 do if 10^(-n - 1) < abs(evalf(tan(i)) - floor(evalf(tan(i)) + 1/2)) and abs(evalf(tan(i)) - floor(evalf(tan(i)) + 1/2)) < 10^(-n) then print(i); n := n + 1; i := 1; end if; end do;
-
Mathematica
Transpose[Table[Catch[Table[Table[{i, j}; If[10^(-i - 1) < Abs[Tan[j] - Round[Tan[j]]] && Abs[Tan[j] - Round[Tan[j]]] < 10^(-i), Throw[{i, j}]], {i}], {j, 10^(i+1)}]], {i, 10}]][[-1]] (* Bence BernĂ¡th, Jul 07 2021 *)
-
PARI
a(n) = my(m); default(realprecision, 2*n); for(k=1, oo, if(10^-n > (m=abs(tan(k)-round(tan(k)))) && m > 10^(-n-1), return(k))); \\ Jinyuan Wang, Jun 18 2021
Comments