Isn't this fun!! I tried a "manual" calculation in both double and long variables:

```
void calcDouble() {
double c=11, cPow2 = c*c, cPow4 = cPow2*cPow2,
cPow8 = cPow4*cPow4,cPow16 = cPow8*cPow8,
cPow23 = cPow16*cPow4*cPow2*c;
System.out.println(cPow23 + " " + cPow23%187);
}
void calcLong() {
long c=11, cPow2 = c*c, cPow4 = cPow2*cPow2,
cPow8 = cPow4*cPow4,cPow16 = cPow8*cPow8,
cPow23 = cPow16*cPow4*cPow2*c;
System.out.println(cPow23 + " " + cPow23%187);
}
```

Which gave the following results:

8.954302432552372E23 175.0

6839173302027254275 65

neither of which match yours.

Personally I'd put my money on the long manual version.

Any other offers?

Funnily...

```
public class test {
public static void main(String[] args)
{
long hyz = (long) Math.pow(11.0, 23.0);
hyz = hyz%187;
System.out.println(hyz);
}
}
```

Output = 161?

Also, I edited your code a bit and checked...

```
int c = 11;
int d = 23;
int n = 187;
long dt;
dt = (long)((Math.pow(c,d)));
long rc = dt%n;
System.out.println(rc);
```

I put the modulus n part in another line... and whoa! 161

So, you want this, right? (11^23)%187?

Yeah, he's right. Another version of my code got 65 as output. I guess that's what's dwindling your answer... :\

If you try writing a piece of code to find out the exponent of a number, and you try solving 11^23, you get 6839173302027254275.Then, if you try finding out it's remainder with 187, you get 65, which is wrong, I guess, as per you.

The correct answer is, as you say, 88. The problem - I have recognized it. It's not that we're doing anything wrong with the code. 895430243255237372246531, which is the value of 11^23, is too large a number even for long. :)

It is not computed properly by the compiler. The number is just too big.

Solved by myself..

```
import java.math.BigInteger;
public class abc3
{
public static void main(String ar[])
{
BigInteger ct = new BigInteger("11");
BigInteger n = new BigInteger("187");
BigInteger d = new BigInteger("23");
BigInteger e = new BigInteger("7");
BigInteger decr = ct.modPow(d,n);
System.out.println("Decr = "+decr);
}
}
```

and now the output is 88.

thanks all