Quick actions

cmd+k|ctrl+k

Navigation

Languages

Untitled

Snippet info

Language

Python

Visibility

unlisted

Author

legacy-anonymous

Created

2024-10-29T17:09:33.500067Z

Updated

2024-10-29T17:09:33.500067Z


def check(i, fn):
        r = 0
        for j in range(7):
                if fn(i % 10):
                        r = r + 1
                i = int(i / 10)
        return r


for i in range(10000000):
        if check(i, lambda x: x == 0) + 1 == int(i / 1000000 % 10) and \
           check(i, lambda x: x == 1) + 1 == int(i / 100000 % 10) and \
           check(i, lambda x: x == 2) + 1 == int(i / 10000 % 10) and \
           check(i, lambda x: x == 3) + 1 == int(i / 1000 % 10) and \
           check(i, lambda x: x % 2 == 0) + 2 == int(i / 100 % 10) and \
           check(i, lambda x: x % 2 == 1) + 2 == int(i / 10 % 10) and \
           check(i, lambda x: x in [2,3,5,7]) + 2 == int(i % 10):
                print(i)
INFO