Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def abs_sorted_pairs():
- pair_sum = 0
- while True:
- for a in range(pair_sum + 1):
- b = pair_sum - a
- for a_flip in ([1] if a == 0 else [1, -1]):
- for b_flip in ([1] if b == 0 else [1, -1]):
- yield a * a_flip, b * b_flip
- pair_sum += 1
- if __name__ == '__main__':
- print('first 100:')
- for i, p in zip(range(100), abs_sorted_pairs()):
- print(p)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement