OFFSET
0,3
COMMENTS
LINKS
FORMULA
a(n) = floor(agm(n+n,n*n)).
EXAMPLE
a(2) = floor(agm(2+2, 2*2)) = floor(agm(4, 4)) = 4.
a(5) = floor(agm(10.0, 25.0)) = floor(agm(17.5, 15.811388)) = floor(agm(16.655695, 16.634281)) = floor(agm(16.644987, 16.644983)) = floor(16.644987) = 16.
MATHEMATICA
Table[Floor[ArithmeticGeometricMean[2n, n^2]], {n, 0, 70}] (* Harvey P. Dale, Aug 03 2014 *)
PROG
(Java) public class Agmnxn {
private static final double TOLERANCE = Math.pow(10, -4);
private static final long LENGTH = 250;
public static void main(String[] args) {
String series="";
long n=0;
while (series.length()<LENGTH) {
long x=(long) Math.floor(agm(n+n, n*n));
series+=x+", ";
n++;
}
System.out.println(series);
}
private static double agm(double a, double g) {
return Math.abs(a-g)<TOLERANCE?a:agm((a+g)/2, Math.sqrt(a*g));
}
}
CROSSREFS
KEYWORD
nonn,easy
AUTHOR
John R Phelan, Nov 11 2013
STATUS
approved