OFFSET
0,2
EXAMPLE
For n = 4, a(n) = 22 because 22 is the smallest positive integer k such that 10^(-5) < |cos(k) - round(cos(k))| < 10^(-4): |cos(22) - round(cos(22))| = 0.0000391...
PROG
(C++)
/* Only suitable for computing a(0) to a(15) due to double precision limits. */
#include <iostream>
#include <cmath>
using namespace std;
int main(int argc, char** argv) {
for (int n=0; n<=15; n++) {
for (int k=1; k<=20530996; k++) {
double x = cos(k);
double val = abs(x-round(x));
if (val < pow(10, -n) && val > pow(10, -n-1)){
cout << k <<", ";
break;
}
}
}
}
(PARI) a(n) = my(k=1, ok=0, x); while (!ok, x=abs(cos(k) - round(cos(k))); ok = (x>1/10^(n+1)) && (x < 1/10^n); if (ok, break); k++); k; \\ Michel Marcus, Jul 02 2021
CROSSREFS
KEYWORD
nonn,more
AUTHOR
Treanungkur Mal, Jul 02 2021
EXTENSIONS
a(16)-a(17) from Jon E. Schoenfield and Sean A. Irvine, Jul 03 2021
STATUS
approved