

A308879


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


0



8, 33, 699, 9929, 51819, 573204, 4846147, 37362253, 288632526, 9251925681, 81129397337, 881156436695
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,1


COMMENTS

Naturally, sin(a(n)) is the best approximation to 1 for an ndigit integer argument. a(n) is the closest integer to an ndigit 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.


LINKS

Table of n, a(n) for n=1..12.


EXAMPLE

For n=3, a(3)=699 since no other 3digit 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.


PROG

(C)
double e = 1.0;
int b = 0, d=1, c=10;
int a[10]; // print A to see the results
for( int i=0; d<10; i++ )
{
double y = double(i*4+1)*PI/2.0;
double z = round(y);
double f = abs(zy);
int w = int(z);
if( w>=c ) { a[d]=b; c*=10; e=1.0; b=0; d++; }
if( f< e ) { e=f; b=w; }
}


CROSSREFS

Cf. A046959.
Sequence in context: A069509 A204191 A041118 * A297904 A298498 A091720
Adjacent sequences: A308876 A308877 A308878 * A308880 A308881 A308882


KEYWORD

nonn,base,more


AUTHOR

Inigo Quilez, Feb 12 2020


STATUS

approved



