Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int po3 = (int) Math.pow(3, Math.floor(Math.log10(n) / Math.log10(3)));
- int w = n;
- int i = po3;
- if (po3 != n) {
- while (i++ < n) {
- w = (w + 1) % n;
- if (w > po3) {
- w++;
- }
- }
- }
- System.out.println("Part 2: " + w);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement