TITLE: Minimum n for which $2020^n+1$ is prime
QUESTION [5 upvotes]: I wish to find the minimum value of Positive integer $n$ for which $2020^n+1$ is a prime number.
Since $n$ cannot be odd or of the form $2^jK$, therefore $n$ must be of the form $2^k$. How to proceed further?

REPLY [3 votes]: This first bit is a tiny part of Miller-Rabin. It is just checking, as in Fermat's LITTLE theorem, whether $2^{n-1} \equiv 1 \pmod n.$ It is not for these first few values of $n =1 + 2020^{\left( 2^k  \right)} \; . \; \;$  It appears that I made $k$ equal to "count" minus one.
==============================================
Tue Sep 15 06:07:06 PDT 2020

 count 1 n or n % 1000000:   2021
  2^(n-1) mod n or that % 1000000:  661
  4^(n-1) mod n or that % 1000000:  385
  5^(n-1) mod n or that % 1000000:  883
  101^(n-1) mod n or that % 1000000:  1046


 count 2 n or n % 1000000:   4080401
  2^(n-1) mod n or that % 1000000:  392873
  4^(n-1) mod n or that % 1000000:  696939
  5^(n-1) mod n or that % 1000000:  415506
  101^(n-1) mod n or that % 1000000:  201073


 count 3 n or n % 1000000:   16649664160001
  2^(n-1) mod n or that % 1000000:  7948
  4^(n-1) mod n or that % 1000000:  521537
  5^(n-1) mod n or that % 1000000:  312595
  101^(n-1) mod n or that % 1000000:  917808


 count 4 n or n % 1000000:   277211316640788505600000001
  2^(n-1) mod n or that % 1000000:  65536
  4^(n-1) mod n or that % 1000000:  967296
  5^(n-1) mod n or that % 1000000:  890625
  101^(n-1) mod n or that % 1000000:  778611


 count 5 n or n % 1000000:   76846114073719506240708648109081231360000000000000001
  2^(n-1) mod n or that % 1000000:  419286
  4^(n-1) mod n or that % 1000000:  63545
  5^(n-1) mod n or that % 1000000:  602437
  101^(n-1) mod n or that % 1000000:  663872


 count 6 n or n % 1000000:   1
  2^(n-1) mod n or that % 1000000:  928344
  4^(n-1) mod n or that % 1000000:  551554
  5^(n-1) mod n or that % 1000000:  527082
  101^(n-1) mod n or that % 1000000:  23082


 count 7 n or n % 1000000:   1
  2^(n-1) mod n or that % 1000000:  808526
  4^(n-1) mod n or that % 1000000:  595382
  5^(n-1) mod n or that % 1000000:  982181
  101^(n-1) mod n or that % 1000000:  749767


 count 8 n or n % 1000000:   1
  2^(n-1) mod n or that % 1000000:  959018
  4^(n-1) mod n or that % 1000000:  26848
  5^(n-1) mod n or that % 1000000:  768460
  101^(n-1) mod n or that % 1000000:  848154


 count 9 n or n % 1000000:   1
  2^(n-1) mod n or that % 1000000:  747693
  4^(n-1) mod n or that % 1000000:  986246
  5^(n-1) mod n or that % 1000000:  31483
  101^(n-1) mod n or that % 1000000:  323871


 count 10 n or n % 1000000:   1
  2^(n-1) mod n or that % 1000000:  210163
  4^(n-1) mod n or that % 1000000:  581207
  5^(n-1) mod n or that % 1000000:  920926
  101^(n-1) mod n or that % 1000000:  393805


 count 11 n or n % 1000000:   1
  2^(n-1) mod n or that % 1000000:  70595
  4^(n-1) mod n or that % 1000000:  593199
  5^(n-1) mod n or that % 1000000:  971165
  101^(n-1) mod n or that % 1000000:  587666


 count 12 n or n % 1000000:   1
  2^(n-1) mod n or that % 1000000:  408027
  4^(n-1) mod n or that % 1000000:  331817
  5^(n-1) mod n or that % 1000000:  817564
  101^(n-1) mod n or that % 1000000:  571971

=============================================
It took a while to finish 13
 count 13 n or n % 1000000:   1
  2^(n-1) mod n or that % 1000000:  447838
  4^(n-1) mod n or that % 1000000:  192814
  5^(n-1) mod n or that % 1000000:  108756
  101^(n-1) mod n or that % 1000000:  270600

==========================================
int mp_PrimeQ( mpz_class  i)
{
  if ( i <= 0 ) return 0;
  else if ( i == 1 ) return 1;
  else return  mpz_probab_prime_p( i.get_mpz_t() , 50 );
} // mp_PrimeQ

int mp_CompositeQ( mpz_class  i)
{
 
   return !(mp_PrimeQ(i));
} // mp_PrimeQ

=======================================================================
Sun Sep 13 11:56:09 PDT 2020

0   2021 = 43  47
 PrimeQ  0 

1   4080401 = 13 281  1117
 PrimeQ  0 

2   16649664160001 = 325217  51195553
 PrimeQ  0 

3   277211316640788505600000001 = 17  cdot mbox{BIG} 
 PrimeQ  0 

4   76846114073719506240708648109081231360000000000000001 = 1153  cdot mbox{BIG} 
 PrimeQ  0 

5    =  cdot mbox{BIG} 
 PrimeQ  0 

6    = 257 11777  cdot mbox{BIG} 
 PrimeQ  0 

7    = 638977  cdot mbox{BIG} 
 PrimeQ  0 

8    = 15361 51713  cdot mbox{BIG} 
 PrimeQ  0 

9    = 19457  cdot mbox{BIG} 
 PrimeQ  0 

10    =  cdot mbox{BIG} 
 PrimeQ  0 

11    =  cdot mbox{BIG} 
 PrimeQ  0 

12    =  cdot mbox{BIG} 
 PrimeQ  0 

13    = 65537 163841  cdot mbox{BIG} 
 PrimeQ  0