Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class HelloWorld {
- public static void main(String[] args) {
- long premod = 1;
- long mod = 0;
- int i = 0;
- while (i<9721) {
- mod = ((long)Math.pow(3, 127))%100000;
- premod = mod*premod;
- i++;
- }
- System.out.println("premod is : "+premod);
- System.out.println("solution is : "+premod%100000);
- String s = Long.toString(premod);
- System.out.print("The last five digits are \t");
- for(int j = s.length()-5 ; j<s.length() ; j ++)
- System.out.print(s.charAt(j));
- }
- }
- /*
- OUTPUT :
- premod is : 8520365264649205535
- solution is : 5535
- The last five digits are 05535
- */
Advertisement
Add Comment
Please, Sign In to add comment