question about Tetration

Posted by davit-datuashvili on Stack Overflow See other posts from Stack Overflow or by davit-datuashvili
Published on 2010-05-29T13:55:40Z Indexed on 2010/05/29 14:02 UTC
Read the original article Hit count: 121

Filed under:
|

i have question how write program which calculates following procedures

http://en.wikipedia.org/wiki/Tetration

i have exponential program which returns x^n here is code

public class Exp{
public static long  exp(long x,long n){
   long t=0;
 if (n==0){
     t= 1;
}
else{
       if (n %2==0){
   t=  exp(x,n/2)* exp(x,n/2);

}
else{

 t= x*exp(x,n-1);
}

}
 return t;
}


public static  void main(String[]args){
long x=5L;
long n=4L;
 System.out.println(exp(x,n));


}
}

but how use it in Tetration program?please help

© Stack Overflow or respective owner

Related posts about java

Related posts about algorithm