package com;
import java.math.BigInteger;
public class Marik
{
public static BigInteger fac(long n)
if(n == 0 || n == 1)
return BigInteger.ONE;
}
else if(n > 1)
return fac(n - 1).multiply(BigInteger.valueOf(n));
else
return BigInteger.ZERO;
public static void main(String[] args)
BigInteger sum = BigInteger.ZERO;
long n = 1;
BigInteger b9999 = BigInteger.valueOf(9999);
while(sum.compareTo(b9999) <= 0)
sum = sum.add(fac(n));
n++;
System.out.println(n);
package com;
import java.math.BigInteger;
public class Marik
{
public static BigInteger fac(long n)
{
if(n == 0 || n == 1)
{
return BigInteger.ONE;
}
else if(n > 1)
{
return fac(n - 1).multiply(BigInteger.valueOf(n));
}
else
{
return BigInteger.ZERO;
}
}
public static void main(String[] args)
{
BigInteger sum = BigInteger.ZERO;
long n = 1;
BigInteger b9999 = BigInteger.valueOf(9999);
while(sum.compareTo(b9999) <= 0)
{
sum = sum.add(fac(n));
n++;
}
System.out.println(n);
}
}