login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A308879 a(n) is the n-digit integer m that maximizes sin(m). It's also the n-digit integer that minimizes the mean square error of the approximation sin(x+m) for cos(x) over [0, 2*Pi]. 0

%I

%S 8,33,699,9929,51819,573204,4846147,37362253,288632526,9251925681,

%T 81129397337,881156436695

%N a(n) is the n-digit integer m that maximizes sin(m). It's also the n-digit integer that minimizes the mean square error of the approximation sin(x+m) for cos(x) over [0, 2*Pi].

%C Naturally, sin(a(n)) is the best approximation to 1 for an n-digit integer argument. a(n) is the closest integer to an n-digit number of the form (4k+1)*Pi/2. Often used to compute an approximated rotation matrix with just a few number of characters of code, as in M = sin(x+{0,699,-699,0}). It is not guaranteed that each term in the sequence produces a better approximation than the previous one, although numerical evidence suggests so. It is therefore also not guaranteed to be a subsequence of A046959.

%e For n=3, a(3)=699 since no other 3-digit integer m makes sin(x+m) closer to cos(x) than m=699 does. For example cos(4.5)=-0.210795799... and sin(4.5+699)=-0.215061112... and no other value of m will make the latter closer to the former.

%o (C)

%o double e = 1.0;

%o int b = 0, d=1, c=10;

%o int a[10]; // print A to see the results

%o for( int i=0; d<10; i++ )

%o {

%o double y = double(i*4+1)*PI/2.0;

%o double z = round(y);

%o double f = abs(z-y);

%o int w = int(z);

%o if( w>=c ) { a[d]=b; c*=10; e=1.0; b=0; d++; }

%o if( f< e ) { e=f; b=w; }

%o }

%Y Cf. A046959.

%K nonn,base,more

%O 1,1

%A _Inigo Quilez_, Feb 12 2020

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified January 24 18:07 EST 2021. Contains 340411 sequences. (Running on oeis4.)