News for hackers. Stuff that matters.
Re:Numbers 0 to 11111 in terms of Increasing and Decreasing ... by metaphor on Wednesday January 11, 2017 @01:21AM (#13372150)

  3 = 123+4+5-6*7^89
First verifiable instance of error?

Did a little fishing for overflow candidates with the following regex:

  [1-9]{3,}\^[1-9]{3,}
...caught 58 results between 266 and 10940:

  266 = 123^456-78-9
  ...
  10940 = 12345^6789
My kung fu isn't Python so I don't know how types are handled. That eval() function sure smells suicidal for anything remotely serious though.
Re:Numbers 0 to 11111 in terms of Increasing and Decreasing ... by witty_username on Wednesday January 11, 2017 @02:14AM (#13372340)
No, Python doesn't have integer overflow.

"^" is the XOR operator. GP's code has that bug.

> That eval() function sure smells suicidal for anything remotely serious though.

Yes, ast.literal_eval() should be used.

Re:Numbers 0 to 11111 in terms of Increasing and Decreasing ... by adtac on Wednesday January 11, 2017 @03:41AM (#13372608)
Ugh, fixed it.

Using * * is not really an option now because it takes insane amounts of time to compute something like `123456789`.

And this is just a tiny script - `eval` shouldn't really be an issue. And yes, I know it's evil, generally. But if you think about it, Python itself is just one big eval loop :P