發新話題
打印

只用0和1組合13,17,19的倍數

剛剛用一小段程式跑了一下,

最小的滿足題意的自然數是 \(11001110000101=13\times17\times19\times2619935699\),

其中 \(2619935699\) 是一個質數。
複製內容到剪貼板
代碼:
//以下使用 Kotlin 語言

import java.math.BigInteger

fun main() {

    val divisor : BigInteger = BigInteger((13*17*19).toString())

    (1..Int.MAX_VALUE).forEach {
        if(BigInteger(Integer.toBinaryString(it)).mod(divisor) == BigInteger("0"))
            println(Integer.toBinaryString(it))
    }
}
其結果枚舉如下....
11001110000101
11101000011101
100011000100011
110011100001010
111010000111010
1000110001000110
1001011001001011
1010001110011101
1011011100100001
1100110101000001
1100111000010100
1101110000010111
1110100001110100
......<列不完>

多喝水。

TOP

發新話題