<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    On 23.04.2018 17:59, Steve Holden wrote:<br>
    <blockquote type="cite"
cite="mid:CAMofdRDGmwfZB9euY1eohnCHNuP0i=GLaWnJBEhdFJypskrG0w@mail.gmail.com">
      <meta http-equiv="Context-Type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div class="gmail_extra">
          <div class="gmail_quote">
            <div><br>
              <div class="gmail_default">While Tim's expression might
                look (superficially) like C, the five-line alternative
                isn't exactly an inspiring example of Pythonicity, is
                it?</div>
              <br>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    What about<br>
    <br>
    <pre wrap="">diff = x - x_base
if diff and gcd(diff, n) > 1:
    return gcd(diff, n)

# or
</pre>
    <pre wrap="">if (x - x_base) and gcd(x - x_base, n) > 1:
    return gcd(x - x_base, n)


</pre>
    and have the interpreter handle the optimization, or apply an
    lru_cache? ;-)<br>
    <br>
    Cheers,<br>
    Sven<br>
  </body>
</html>