ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 23 Feb 2022 07:33:18 +0100discrete_log?!https://ask.sagemath.org/question/61249/discrete_log/So is it working at all?
In Mathematica:
In[88]:= MultiplicativeOrder[3, 401, 138]
Out[88]= 318
In SageMath 9.4:
discrete_log(138, 3, 401-1)
...
"ValueError: No discrete log of 138 found to base 3"
I tried 401 and operation="*"
What I want?
I want 318, because, in Python:
pow(3,318,401)=138Mon, 21 Feb 2022 23:48:50 +0100https://ask.sagemath.org/question/61249/discrete_log/Answer by rburing for <p>So is it working at all?</p>
<p>In Mathematica:</p>
<pre><code>In[88]:= MultiplicativeOrder[3, 401, 138]
Out[88]= 318
</code></pre>
<p>In SageMath 9.4:</p>
<pre><code>discrete_log(138, 3, 401-1)
...
"ValueError: No discrete log of 138 found to base 3"
</code></pre>
<p>I tried 401 and operation="*"</p>
<p>What I want?
I want 318, because, in Python:</p>
<pre><code>pow(3,318,401)=138
</code></pre>
https://ask.sagemath.org/question/61249/discrete_log/?answer=61261#post-id-61261You asked for the discrete logarithm in the ring of integers $\mathbb{Z}$. You meant the following:
sage: discrete_log(Mod(138,401), Mod(3,401), 401-1)
318Tue, 22 Feb 2022 23:05:55 +0100https://ask.sagemath.org/question/61249/discrete_log/?answer=61261#post-id-61261Comment by Dennis Yurichev for <p>You asked for the discrete logarithm in the ring of integers $\mathbb{Z}$. You meant the following:</p>
<pre><code>sage: discrete_log(Mod(138,401), Mod(3,401), 401-1)
318
</code></pre>
https://ask.sagemath.org/question/61249/discrete_log/?comment=61266#post-id-61266Thanks for your reply!Wed, 23 Feb 2022 07:33:18 +0100https://ask.sagemath.org/question/61249/discrete_log/?comment=61266#post-id-61266