Skip to content

Instantly share code, notes, and snippets.

@RYSF13
Last active February 14, 2026 12:08
Show Gist options
  • Select an option

  • Save RYSF13/74cb504688faa80b79b5fa7c0663594c to your computer and use it in GitHub Desktop.

Select an option

Save RYSF13/74cb504688faa80b79b5fa7c0663594c to your computer and use it in GitHub Desktop.
Calculate sqrt(2) to 2333 digits(use spigot)
R=1e3,o,b=1413,e,r[1414],t=800;main(S){for(;o<b;r
[o++]=14);for(;t--;e+=*r*R,printf("%02d",e/R),*r=
e%R)for(e=0,S=b;--S;e/=o,e*=2*S-1)r[S]=(e+=r[S]*R
)%(o=100*S);}/*- √2 2333 digits - Robert Y.S. -*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment