Add tags

Add tags to the following comment
おなじアルゴリズムになってしまいました。
100個目は1536。
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
public class Int235 {
    public static void main(String[] a) {
        int limit = 100;
        for (int n = 0, i = 1; n < limit; i++) {
            int tmp = i;
            while (tmp % 2 == 0) tmp /= 2;
            while (tmp % 3 == 0) tmp /= 3;
            while (tmp % 5 == 0) tmp /= 5;
            if (tmp == 1) {
                System.out.println(i);
                n++;
            }
        }
    }
}

Add tags

The input will be splited to tags with space.

Index

Feed

Other

Link

Pathtraq

loading...