package yukicoder; public class Main{ public static void main(String[] args) { new Main().solve(); } void solve() { int count = 0; for (long i = 1_000_000_000L; i >= 1; i--) { long d = i * (i + 1) - 1; if (d <= 1_000_000_000_000_000_000L) { while (!iscorrect(d)) { System.out.println(d); d--; count++; if (count == 100000) return; } } } } boolean iscorrect(long d) { long ans = calc(d); if (ans * ans + ans <= d && (ans + 1) * (ans + 1) + (ans + 1) > d) { return true; } else return false; } long calc(long d) { return (long) ((-1 + Math.sqrt(1 + 4 * d)) / 2.0); } }