login
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).
2
11, 22, 1120, 355, 14817, 286602, 5117932, 144316263, 167004362, 8984683957
OFFSET
1,1
COMMENTS
In other words, a(n) is the smallest positive integer k such that the distance between tan(k) and nearest integer to tan(k) is smaller than 10^(-n), but greater than 10^(-n-1).
EXAMPLE
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).
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 *)
PROG
(C++) #include <iostream>
#include <cmath>
using namespace std; int main(int argc, char** argv) {long double n=1; int q=2; for(n=1; n<=10; n++){for(int i=q; i<=100000000000; i++){long double k=tan(i); if(abs(k-round(k))<pow(10, -n)&&abs(k-round(k))>pow(10, -n-1)){cout<<i<<", "; break; }}}}
(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
CROSSREFS
Sequence in context: A094620 A077431 A118133 * A225186 A155973 A351849
KEYWORD
nonn,more,hard
AUTHOR
Andrzej Kukla, Jun 18 2021
STATUS
approved