%I
%S 0,1,2,3,4,8,10,14,15,24,26,36,63,98,110,123,126,139,235,243,315,363,
%T 386,391,494,1131,1220,1503,1858,4346,6958,7203,10988,22316,33508,
%U 43791,45535,61840,95504,101404,106143,107450,136244,178428
%N Numbers n such that 3^n + 2 is prime.
%C From _Farideh Firoozbakht_ and _M. F. Hasler_, Dec 06 2009: (Start)
%C If Q is a perfect number such that gcd(Q, 3(3^a(n) + 2)) = 1, then x = 3^(a(n)  1)*(3^a(n) + 2)*Q is a solution of the equation sigma(x) = 3(x  Q). This is a result of the following theorem:
%C Theorem: If Q is a (q1)perfect number for some prime q, then for all integers t, the equation sigma(x) = q*x  (2t+1)*Q has the solution x = q^(k1)*p*Q whenever k is a positive integer such that p = q^k + 2t is prime, gcd(q^(k1), p) = 1 and gcd(q^(k1)*p,Q) = 1.
%C Note that by taking t = 1/2(m*q+1), this theorem gives us some solutions of the equation sigma(x) = q *(x + m*Q). See comment lines of the sequence A058959. (End)
%C No further terms < 200000.  _Ray Chandler_, Jul 31 2011
%C A090649 implies that 361608 is a member of this sequence.  _Robert Price_, Aug 18 2014
%C No further terms < 320000.  _Luke W. Richards_, Mar 04 2018
%H F. Firoozbakht, M. F. Hasler, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL13/Hasler/hasler2.html">Variations on Euclid's formula for Perfect Numbers</a>, JIS 13 (2010) #10.3.1
%H Henri & Renaud Lifchitz, <a href="http://www.primenumbers.net/prptop/searchform.php?form=3%5En%2B2&action=Search">PRP Records</a>.
%e 3^8 + 2 = 6563 is prime, so 8 is in the sequence.
%e 3^26 + 2 = 2541865828331, a prime number, so 26 is in the sequence.
%t A051783 = Select[Range[0, 20000], PrimeQ[3^# + 2] &]
%o (PARI) is(n)=ispseudoprime(3^n+2) \\ _Charles R Greathouse IV_, Mar 21 2013
%Y Cf. A057735, A087885, A014224, A058959.
%K nonn,hard
%O 1,3
%A _Jud McCranie_, Dec 09 1999
%E {4346, 6958, 7203} from _David J. Rusin_, Sep 29 2000
%E 10988 from _Ray Chandler_, Nov 21 2004
%E {22316, 33508} found by _Henri Lifchitz_, SepOct 2002
%E {43791, 45535, 61840} found by _Henri Lifchitz_, OctNov 2004
%E 95504 found by Wojciech Florek Dec 15 2005.  _Alexander Adamchuk_, Mar 02 2008
%E Edited by _N. J. A. Sloane_, Dec 19 2009
%E {101404, 106143, 107450, 136244} from _Mike Oakes_, Nov 2009
%E 178428 from _Ray Chandler_, Jul 29 2011
