Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: primitive root error

  • To: mathgroup at smc.vnet.net
  • Subject: [mg128101] Re: primitive root error
  • From: Andrzej Kozlowski <akozlowski at gmail.com>
  • Date: Sun, 16 Sep 2012 03:22:14 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <k2ub15$h9h$1@smc.vnet.net> <20120915073839.53E3C6859@smc.vnet.net>

On 15 Sep 2012, at 09:38, daniel.lichtblau0 at gmail.com wrote:

> On Thursday, September 13, 2012 11:16:47 PM UTC-5, Dan Dubin wrote:
>> The number theoretic function PrimitiveRoot[n]  is supposed to give the
>>
>> smallest generator for the multiplicative group of integers module n
>>
>> relatively prime to n.  However, Mathematica 8  says that
>>
>> PrimitiveRoot[18] equals 11. This is incorrect. While this is a
>>
>> generator, it is not the smallest generator of the group. The correct
>>
>> answer is 5:
>>
>>
>>
>> In[1]:= Table[Mod[5^n, 18], {n, 0, 6}]
>>
>>
>>
>> Out[1]= {1, 5, 7, 17, 13, 11, 1}
>
> 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}
>
> Daniel Lichtblau
> Wolfram Research
>
>
>


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



  • Prev by Date: Re: Landau letter, Re: Mathematica as a New Approach...
  • Next by Date: How to solve the integrate problem
  • Previous by thread: Re: primitive root error
  • Next by thread: Re: primitive root error