News for hackers. Stuff that matters.
Re:Mathematicians Outwit Hidden Number Conspiracy by librexpr on Tuesday January 04, 2022 @03:13PM (#29799703)
Hmm, good try, but it's not quite right. Here's a simpler way to get all the numbers divisible by 2, 3, 5, or 7, in a 100-number range, and which I think is easier to verify that it's correct:

    numbers_not_divisible_by_2_3_5_7 = []
    for i in range(520, 620):
        is_divisible = False
        for p in [2, 3, 5, 7]:
            if i % p == 0:
                is_divisible = True
                break
        if not is_divisible:
            numbers_not_divisible_by_2_3_5_7.append(i)

    print(numbers_not_divisible_by_2_3_5_7)
    print(len(numbers_not_divisible_by_2_3_5_7))
And if you run this code you'll find that it demonstrates a counterexample. Between 520 and 620 there are 25 numbers which are not divisible by 2, 3, 5, or 7:

[521, 523, 527, 529, 533, 541, 547, 551, 557, 559, 563, 569, 571, 577, 583, 587, 589, 593, 599, 601, 607, 611, 613, 617, 619]

You really need to use all the primes from 2 to 13 inclusive to get a limit of 23. And even then I was only able to prove it by brute-forcing up to the primorial of 13, but maybe there's a simpler way.

Re:Mathematicians Outwit Hidden Number Conspiracy by tzs on Tuesday January 04, 2022 @03:44PM (#29800180)
You are right. To fix mine, I'd need to take into account the actual endpoints of the interval instead of just the length of the interval. For each divisor d there would be a separate case to consider for each possible value of 10n mod d. This seems like it would greatly complicate my approach.