#!/usr/bin/env python def maxkeys(n, table): if n <= 6: table.extend(range(n + 1)) else: maxkeys(n - 1, table) table.append(max([v * (n - x - 1) for x, v in enumerate(table) if x <= n - 3])) t = [] maxkeys(22, t) print(t)

Advertisements

#!/usr/bin/env python def maxkeys(n, table): if n <= 6: table.extend(range(n + 1)) else: maxkeys(n - 1, table) table.append(max([v * (n - x - 1) for x, v in enumerate(table) if x <= n - 3])) t = [] maxkeys(22, t) print(t)

Advertisements