So I am doing this problem which requires to calculate the equations. At first i thought long
would be enough for the range but now it has exceeded the long
range and now i have to use BigInteger
. I have to convert one equation but I haven't been able to
This is the equation :
count =(n2/n3)-((n1-1)/n3);
Count can be long
but n1
,n2
,n3
should be BigInteger
.
This simplifies to:
and in Java