OFFSET
1,1
COMMENTS
a(n) = 1 iff n is in A014574.
If a(n) = 0, then n is in A097764.
If a(n) > 1 then A367566(n) divides a(n). - Jon E. Schoenfield, Nov 23 2023
LINKS
Jon E. Schoenfield, Table of n, a(n) for n = 1..200 (first 77 terms from Michel Marcus)
EXAMPLE
1*1^1+1 (2) and 1*1^1-1 (0) are not both prime. 1*2^1+1 (3) and 1*2^1-1 (1) are not both prime. 1*3^1+1 (4) and 1*3^1-1 (2) are not both prime. 1*4^1+1 (5) and 1*4^1-1 (3) are both prime. So, a(1) = 4.
MATHEMATICA
zeroQ[n_] := Module[{f = FactorInteger[n]}, pow = GCD @@ f[[;; , 2]]; n > 4 && AnyTrue[Divisors[pow], # > 1 && Divisible[n, #] &]];
a[n_, kmax_] := Module[{k = 1}, If[zeroQ[n], 0, While[k <= kmax && ! And @@ PrimeQ[n*k^n + {-1, 1}], k++]; If[k < kmax, k, -1]]]; Table[a[n, 10^6], {n, 1, 25}] (* Amiram Eldar, Nov 18 2023, returns -1 if the search limit should exceed kmax *)
PROG
(PARI) bot(n) = for(k=1, 10^5, if(ispseudoprime(n*k^n-1), if(ispseudoprime(n*k^n+1), return(k))));
n=1; while(n<100, print1(bot(n), ", "); n+=1)
(PARI) a(n) = if ((n==16) || (n==27) || (n==36) || (n==64) /* || (n== ... */, return(0)); my(k=1); while (!(ispseudoprime(n*k^n-1) && ispseudoprime(n*k^n+1)), k++); k; \\ Michel Marcus, Nov 18 2023
KEYWORD
nonn
AUTHOR
Derek Orr, Mar 30 2014
EXTENSIONS
a(46) from Giovanni Resta, Mar 31 2014
STATUS
approved