首页 > 代码库 > [C++] Nested Radical Constant

[C++] Nested Radical Constant

做高数助教被天煞的大一学生坑了,发现是个未解问题,没有解析解。。

用C搞了下,就是这样。。。

 

No closed-form expression is known for this constant (Finch 2003, p. 8; S. Plouffe, pers. comm., Aug. 29, 2008).

 

/******************************************@: Nested Radical Constant 嵌套根式常数*@: http://mathworld.wolfram.com/NestedRadicalConstant.html*****************************************/#include "stdafx.h"#include <stdio.h>#include <math.h>void main(void){	int N = 10;	int idx = 0;	double an = 0;	double temp = 0;	an = sqrt(double(N));	for(idx =(N-1);idx >= 1; idx--){		temp = idx + an;		an = sqrt(temp);		}	printf("N=%d,an=%f \n",N,an);	getchar();}

  

[C++] Nested Radical Constant