GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — data-structures/stack/waiter.py at main · ejaj/data-structures Expand file tree/ Copy pathwaiter.pyMore file actions executable file ·28 lines (26 loc) · 710 Bytes / Copy pathwaiter.pyFile metadata and controlsexecutable file ·28 lines (26 loc) · 710 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 def waiter(number, q): primegen = [1] * 10000 prime = [] for i in range(2, 10000): if primegen[i] == 1: for j in range(i,10000,i): primegen[j] = 0 prime.append(i) a = [[] for i in range(q+1)] b = [[] for i in range(q+1)] a[0] = number for i in range(q): while a[i]: plate = a[i].pop() if plate%prime[i] == 0: b[i+1].append(plate) else: a[i+1].append(plate) result = [] for i in range(q+1): while b[i]: result.append(b[i].pop()) for i in range(q+1): while a[i]: result.append(a[i].pop()) return result |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |