Note: there are all sorts of tricks I don’t know to make BCD arithmetic faster, if you need.

]]>

$ time python digits.py

71 2361183241434822606848

```
```real 0m48.748s

user 0m48.712s

sys 0m0.000s

$ time python str.py

71 2361183241434822606848

`real 0m0.575s`

user 0m0.564s

sys 0m0.008s

I edited your comment to change your “code” tag to a “pre” tag and that restored your indentation.

]]>for i in xrange(71, 10000):

p = 2**i

if ’7′ not in str(p):

print i, p

If you really need the SET of digits in x: set(str(x)).

]]>def digits(n): s = set() while n > 0: s.add(n%10) n /= 10 if len(s) == 10: break return s for i in range(100, 100000): p = 2**i if len(digits(p)) < 10: print i, len(digits(p)) if i % 10000 == 0: print "checked",i

I conjecture: maybe 7 is interesting because the rest are all proven.

]]>5 doesn’t seem to be there either.

9 is not present for i=108 but always after until 10000.