@reagentx/

Removed Numbers from List

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
def removNb(n):
    arr = [True] * n
    sum_target = ((n-1) * (1 + (n - 1))) / 2
    out_l = []
    for a in range(2, (len(arr) // 2) + 1):
        b = int(sum_target / a) if (sum_target / a).is_integer() else None
        # Index where the other value might be
        if b and b < len(arr):
            out_l.extend([(a, b), (b, a)])
    return out_l


print(removNb(100))
print(removNb(26))
print(removNb(1000))