cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A345670 a(n) is the smallest integer k > 0 such that 10^(-n-1) < |cos(k) - round(cos(k))| < 10^(-n).

This page as a plain text file.
%I A345670 #61 Jul 10 2021 23:28:55
%S A345670 1,3,11,44,22,16685,5325,1775,710,355,104348,312689,1146408,20530996,
%T A345670 10838702,5419351,165707065,411557987
%N A345670 a(n) is the smallest integer k > 0 such that 10^(-n-1) < |cos(k) - round(cos(k))| < 10^(-n).
%e A345670 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...
%o A345670 (C++)
%o A345670 /* Only suitable for computing a(0) to a(15) due to double precision limits. */
%o A345670 #include <iostream>
%o A345670 #include <cmath>
%o A345670 using namespace std;
%o A345670 int main(int argc, char** argv) {
%o A345670     for (int n=0; n<=15; n++) {
%o A345670         for (int k=1; k<=20530996; k++) {
%o A345670             double x = cos(k);
%o A345670             double val = abs(x-round(x));
%o A345670             if (val < pow(10, -n) && val > pow(10, -n-1)){
%o A345670                 cout << k <<", ";
%o A345670                 break;
%o A345670             }
%o A345670         }
%o A345670     }
%o A345670 }
%o A345670 (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
%Y A345670 Cf. A346033 (sin), A345404 (tan).
%K A345670 nonn,more
%O A345670 0,2
%A A345670 _Treanungkur Mal_, Jul 02 2021
%E A345670 a(16)-a(17) from _Jon E. Schoenfield_ and _Sean A. Irvine_, Jul 03 2021