Message Boards Message Boards

Powers of 71, an explicit exercise in number theory

Attachments:
6 Replies

Thanks for that information Luis! Very well said.

enter image description here - Congratulations! This post is now featured in our Staff Pick column as distinguished by a badge on your profile of a Featured Contributor! Thank you, keep it coming, and consider contributing your work to the The Notebook Archive!

POSTED BY: Moderation Team
Posted 4 years ago

You can speed up a simple loop by knowing that in going from t to t+1, you will need to increase k by a multiple of the MultiplicativeOrder[71,10^t], since we can't destroy the ones we've already established mod 10^t.

MultiplicativeOrder[71,10^4]

is 250. So having found k[4] = 13, you can find k[5]=1513 in 7 tries.

MultiplicativeOrder[71,10^5]`

is 2500, so you can get k[6] in 3 tries.`

POSTED BY: William Isaacs
Posted 4 years ago

Hi Luis Antonio,

Thanks again for the demonstration, I have plenty to learn going back over your very educational post.

I did timing on my idea of using MultiplicativeOrder[]:

k[4] = 13;
k[t_] := k[t] = Module[ 
  {kt,dk,ones}, 
  kt = k[t-1]; 
  dk = MultiplicativeOrder[71,10^(t-1)]; 
  ones = Mod[FromDigits@Table[1, t], 10^t]; 
  While[ 
    PowerMod[71,kt,10^t] != ones, 
    kt = kt + dk ]; 
  kt] 

Table[ AbsoluteTiming[ {t,k[t]}], {t,5,25}  ] // TableForm                                                                                                                                                                                                  

                                5
                    0.0001288   1513

                                6
                    0.0000481   6513

                                7
                    0.0000392   6513

                                8
                    0.0000406   506513

                                9
                    0.000052    13006513

                                10
                    0.0000527   88006513

                                11
                    0.0000519   1088006513

                                12
                    0.0000556   13588006513

                                13
                    0.0000601   163588006513

                                14
                    0.0000802   1413588006513

                                15
                    0.0000764   16413588006513

                                16
                    0.0000524   41413588006513

                                17
                    0.0000484   41413588006513

                                18
                    0.0000656   10041413588006513

                                19
                    0.0023701   160041413588006513

                                20
                    0.0011663   1410041413588006513

                                21
                    0.000427    8910041413588006513

                                22
                    0.0002221   8910041413588006513

                                23
                    0.0007679   2258910041413588006513

                                24
                    0.0005138   14758910041413588006513

                                25
                    0.0007589   239758910041413588006513

The limiting resource in this approach is going to be the MultiplicativeOrder[] call. But even then it looks like you can get k[t] for t in the thousands in reasonable time.

First@AbsoluteTiming[ MultiplicativeOrder[71, 10^5000 ] ]                                                     
2.41778

This order calculation is efficient only because the modulus is easily factored.

POSTED BY: William Isaacs

Thank you for your comments William.

Yours is a good idea, I ran it and it is extremely fast in comparison! The first time I encountered this problem was for $t=2019$, and since my implementation takes a lot of time, specially for the computation of $k_2$, I could only get to $t=20$. With your idea of bypassing the need to calculate $k_1$ and $k_2$, I could get to $t=2019$ in under two minutes, thanks!

For the curious, $k(2019)$ is

2305290672102308631501600234772689901495331656296010173782609457211747
7589012645449972855113002723152850266996581249955310937900637196208377
6015656037190992015601992708978972950218730384956136982230018199914037
1873790474857914308090439690528149039878522176523214171723899120931680
1407795795740287175481595074888464242169114272889833455443538979070710
7954615588986518937269460499977097780936892890288486500115267711198795
7752458754886945509455939738184415246125385661077598946496962529694021
3807498060952467101009725056900507200381670539199960267610955917970647
7348799285007520324333753433137317268595827312669270283710749289135338
3955488775416701421703591611585762587057816965055493289203079657757930
5552781639283256208264236157412839744713189755433693182114657440937393
5151735730964047333464200133046259636266617568495188850439992270539482
5070877950569111185484686258280683360985364614068620085244473016206039
9671853656249766670780202123346133265126530063266776108759382094754654
7716756458855458762042468590857137475911810094709371114227296091704480
6711606499107516880961144418896377536483208496898216007308760220924549
0972474888415801145088826737967372992873259567856816687494684460704424
3173061490180787964985981600770130719077612467850081453816286747633594
4284192328266852157788811299072458199422958623051583550247028984113634
4318289858861052813363039650908790965740078659153247276116386453200334
4836368400516024727032229892621807743635165529464487581545206230448918
1409645082500520804695354024823612306132917021276679585259953063129411
2545858077944461034768509061573193702273821820349478826128151042412868
5956793739278347138201495237865669448730673402603953205685107039200080
8952929651674242338774206988881423049199670391597860260553207517719017
9002932994455476535864508393906288302896457722437946004108041176775861
4329745301223902630302872947877380477704859782754757564959523661085897
7676261776516245911952437104048944340050558070801081399143586315076037
3235657211779132129451895845453642989758910041413588006513
Posted 4 years ago

Hi, just one more optimization after re-reading your post: We don't even have to ask Wolfram for the multiplicative order, you already calculated it. $$\it{ord}_{10^t} 71 = \frac{10^t}{(8)(5)}$$ Thanks again for all of the details working through the problem.

POSTED BY: William Isaacs
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract