![]() |
|
|
#1 |
|
May 2004
13C16 Posts |
This sequence: impossible prime factors of (3^n-2).In pari to test whether 13 is an impossible prime factor of (3^n-2) my code: {is(n)=Mod(3^13)^n==2}; for(n=1,12,print(is(n))).
Is there s shorter cut? |
|
|
|
|
|
#2 |
|
Romulan Interpreter
Jun 2011
Thailand
7×1,373 Posts |
yes, you will only need to test for 3^2 (mod 13), and 3^3 (mod 13) and because this is 1, stop.
(And better use Mod(3,13) instead of the incorrect Mod(3^13), hehe, yeah, I know that is a typo )
Last fiddled with by LaurV on 2018-06-18 at 10:39 |
|
|
|
|
|
#3 |
|
Jun 2003
13BB16 Posts |
znlog(2, Mod(3, 13))
|
|
|
|
|
|
#4 |
|
Feb 2017
Nowhere
4,643 Posts |
If 3 is a quadratic residue (mod p) but 2 is a quadratic non-residue (mod p), then 3^n == 2 (mod p) is impossible. This situation is characterized by the linear congruences
p == 11 or 13 (mod 24). Let q > 2 be a prime. Then as with quadratic residues, we can say, for p == 1 (mod q), If 3 is a q-th power residue (mod p) but 2 is not a q-th power residue (mod p), then 3^n == 2 (mod p) is impossible. Unfortunately, this situation is not characterized by linear congruences. One can test for the condition, for p == 1 (mod q), 3^(p-1)/q == 1 (mod p) but 3^(p-1)/q !== 1 (mod p). Checking for q = 2, 3, 5, and 7 gives the following pairs [p, q] of disqualified primes p < 1000, with the smallest q disqualifying each. [[11, 2], [13, 2], [37, 2], [41, 5], [59, 2], [61, 2], [67, 3], [73, 3], [83, 2], [103, 3], [107, 2], [109, 2], [131, 2], [151, 3], [157, 2], [179, 2], [181, 2], [193, 3], [227, 2], [229, 2], [251, 2], [271, 3], [277, 2], [347, 2], [349, 2], [367, 3], [373, 2], [397, 2], [419, 2], [421, 2], [431, 5], [443, 2], [467, 2], [491, 2], [523, 3], [541, 2], [547, 3], [563, 2], [577, 3], [587, 2], [613, 2], [619, 3], [659, 2], [661, 2], [683, 2], [709, 2], [733, 2], [757, 2], [761, 5], [787, 3], [827, 2], [829, 2], [853, 2], [877, 2], [883, 7], [947, 2], [967, 3], [971, 2], [991, 3], [997, 2]] |
|
|
|
|
|
#5 |
|
Feb 2017
Nowhere
4,643 Posts |
I done screwed up. That'll teach me to think before I post
![]() Obviously, for p > 3, the condition that p divide 3^n - 2 for some n, is that the multiplicative order of 2 (mod p) divide the multiplicative order of 3 (mod p). And, this can happen even if 2 and 3 are both q-th power residues (mod p) for some prime divisor q of p - 1. Examples are p = 193 (q = 2); 307 (q = 3) and 313 (q = 2). |
|
|
|
|
|
#6 | |
|
Jun 2003
5,051 Posts |
Quote:
Code:
isimpossible(p)=Mod(2,p)^znorder(Mod(3,p))!=1 |
|
|
|
|
|
|
#7 |
|
May 2004
22×79 Posts |
|
|
|
|
|
|
#8 | |
|
Feb 2017
Nowhere
4,643 Posts |
Quote:
EDIT: It occurred to me to count how often each of several possible relations between the multipilcative orders occurred. I don't know what is suspected along these lines... Code:
? c1=0;c2=0;c3=0;c4=0;forprime(p=5,10000000,n1=znorder(Mod(3,p));n2=znorder(Mod(2,p));if(n1!=n2&&n1%n2==0,c1++);if(n1!=n2&&n2%n1==0,c2++);if(n1%n2!=0&&n2%n1!=0,c3++);if(n1==n2,c4++));print([c1,c2,c3,c4]) [195328, 195135, 86169, 187945] Last fiddled with by Dr Sardonicus on 2018-06-19 at 13:20 Reason: Adding stuff |
|
|
|
|
![]() |
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| LLL in GP/Pari | paul0 | Programming | 2 | 2015-11-17 13:04 |
| PARI vs GAP | skan | Miscellaneous Math | 0 | 2012-12-16 00:13 |
| pari | devarajkandadai | Programming | 21 | 2012-08-31 18:08 |
| Pari/GP in Linux | CRGreathouse | Software | 15 | 2009-03-22 14:03 |
| 64-bit Pari? | CRGreathouse | Software | 2 | 2009-03-13 04:22 |