Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #11786

Re: primitive root error

From danl@wolfram.com
Newsgroups comp.soft-sys.math.mathematica
Subject Re: primitive root error
Date 2012-09-18 07:46 +0000
Message-ID <k398sa$9oh$1@smc.vnet.net> (permalink)
References <k2ub15$h9h$1@smc.vnet.net> <20120915073839.53E3C6859@smc.vnet.net>
Organization Time-Warner Telecom

Show all headers | View raw


On Sunday, September 16, 2012 2:23:26 AM UTC-5, Andrzej Kozlowski wrote:
> On 15 Sep 2012, at 09:38, somebody wrote:
> [...]
> >
> > Me, I'd call that a mistake in the documentation. Anyway, you can get the smallest by resorting to a crude, nay, barbaric tactic: invoke Wolfram|Alpha to find all the primitive roots.
>
> > In[71]:= WolframAlpha["primitive roots of 18", "MathematicaResult"]
> >
> > Out[71]= {5, 11}
> [...]
> >
>
> This does indeed seem a little barbaric since:
>
>
> WolframAlpha["primitive roots of 18", "MathematicaResult"] // Timing
> 
> {1.87481,{5,11}}
> 
> Select[Range[18],
>
>   MultiplicativeOrder[#, 18] == EulerPhi[18] &] // Timing
>
> {0.000347,{5,11}}
>
>
> Andrzej Kozlowski

Might in part be an issue with establishing a connection to Alpha. It was around 4x faster for me. Repeating brings it to around .03 seconds. Given that this involves a round trip to Alpha, the factor of 10 dominance of that vs. the actual computation is not too surprising.

This variant might be noticeably faster than what you tried though. (Note to the uninitiated: Don't try the other method on this).

WolframAlpha["primitive roots of Prime[18]^18",
  "MathematicaResult"] // Timing

It will give the smallest and largest roots, alomg with the total count.

Daniel Lichtblau
Wolfram Research

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

primitive root error Dan Dubin <ddubin@ucsd.edu> - 2012-09-14 04:15 +0000
  Re: primitive root error daniel.lichtblau0@gmail.com - 2012-09-15 07:45 +0000
  Re: primitive root error Andrzej Kozlowski <akozlowski@gmail.com> - 2012-09-16 07:22 +0000
  Re: primitive root error danl@wolfram.com - 2012-09-18 07:46 +0000

csiph-web