This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.math.BigDecimal; | |
public class R { | |
public static BigDecimal factorial(BigDecimal n) { | |
if (n.equals(BigDecimal.ONE)) { | |
return BigDecimal.ONE; | |
} | |
return n.multiply(factorial(n.subtract(BigDecimal.ONE))); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Zipf { | |
public static void main(String args[]) { | |
long totalWords = 0; | |
for(int i=1; i<=900; i++) { | |
totalWords += 2520/i; | |
} | |
System.out.println("Total words in text: " + totalWords); |
NewerOlder