Let S be the set of all positive integrs having at most 4 digits and such that each of the digits is 0 or 1. What is the greatest prime factor of the sum of all the numbers in S?
我觉得你的解法有问题。
这道题是要算出Set S的元素之和,再找greatest prime factor.
元素有4个position,每个position要么是1要么是0,总共有2*2*2*2等于16个元素,这16个元素里每个position有8个0或者8个1,所以加起来是8888,然后greatest prime factor是101.
这道题麻烦的地方在于不要列出每个element然后再加,这样很耗时间。