Skip to content

Instantly share code, notes, and snippets.

@betaprojects
Created July 5, 2021 16:23
Show Gist options
  • Save betaprojects/905707806b2f349b980db919262f3be1 to your computer and use it in GitHub Desktop.
Save betaprojects/905707806b2f349b980db919262f3be1 to your computer and use it in GitHub Desktop.
c = [1, 2, 3, 6, 7, 9, 18, 19, 25, 27, 54, 55, 73, 97, 129, 171, 231, 235, 313, 327, 649, 654, 655, 667,
703, 871, 1161, 2223, 2322, 2323, 2463, 2919, 3711, 6171, 10971, 13255, 17647, 17673, 23529, 26623,
34239, 35497, 35655, 52527, 77031, 106239, 142587, 156159, 216367, 230631, 410011, 511935, 626331,
837799, 1117065, 1126015, 1501353, 1564063, 1723519, 2298025, 3064033, 3542887, 3732423]
for _ in xrange(input()):
N = input()
print min(c[::-1], key=lambda x:x>N)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment