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

 

Logo

Please make a donation to keep the OEIS running. We are now in our 56th year. In the past year we added 10000 new sequences and reached almost 9000 citations (which often say "discovered thanks to the OEIS").
Other ways to donate

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
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 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.

LINKS

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

EXAMPLE

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.

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(z-y);

      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

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 November 28 07:44 EST 2020. Contains 338702 sequences. (Running on oeis4.)