login
a(n) is the least k such that (2n)^(2^k) + 1 is a prime; a(n) = -1 if a prime (2n)^(2^k) + 1 is unknown, or = -2 if impossible.
2

%I #47 Jul 13 2017 21:47:31

%S 0,0,0,-2,0,0,1,0,0,1,0,1,1,0,0,-2,2,0,-1,0,0,4,0,2,-1,0,1,1,0,0,-1,

%T -2,0,-1,0,0,1,4,0,2,0,1,-1,0,1,-1,1,0,-1,0,0,-1,0,0,1,0,5,1,2,1,-1,1,

%U 0,-2,0,2,1,0,0,2,2,-1,1,0,0,3,2,0,4,1,0,2,0

%N a(n) is the least k such that (2n)^(2^k) + 1 is a prime; a(n) = -1 if a prime (2n)^(2^k) + 1 is unknown, or = -2 if impossible.

%C A prime number of the form b^(2^k) + 1 is called a generalized Fermat prime to base b.

%C See the hyperlink for more information and links.

%C The impossibility case, a(n) = -2, occurs exactly if 2n is a member of A070265. Or equivalently, n is in A126032. - _Jeppe Stig Nielsen_, Jul 02 2017

%H Robert G. Wilson v, <a href="/A228101/b228101.txt">Table of n, a(n) for n = 1..500</a>

%H Lucile and Yves Gallot, <a href="http://yves.gallot.pagesperso-orange.fr/primes/index.html">Welcome to the Generalized Fermat Prime Search!</a>

%t f[b_?EvenQ] := f[b] = Block[{k = 0}, While[! PrimeQ[b^(2^k) + 1], k++]; k];

%t lst = {38, 50, 62, 68, 86, 92, 98, 104, 122, 144, 168, 182, 186, 200, 202, 212, 214, 218, 244, 246, 252, 258, 286, 294, 298, 302, 304, 308, 322, 324, 338, 344, 354, 356, 362, 368, 380, 390, 394, 398, 402, 404, 410, 416, 422, 424, 446, 450, 454, 458, 468, 480, 482, 484, 500, 514, 518, 524, 528, 530, 534, 538, 552, 558, 564, 572, 574, 578, 580, 590, 602, 604, 608, 620, 622, 626, 632, 638, 648, 650, 662, 666, 668, 670, 678, 684, 692, 694, 698, 706, 712, 720, 722, 724, 734, 744, 746, 752, 754, 762, 766, 770, 792, 794, 802, 806, 812, 814, 818, 836, 840, 842, 844, 848, 854, 868, 870, 872, 878, 888, 896, 902, 904, 908, 922, 924, 926, 932, 938, 942, 944, 948, 954, 958, 964, 968, 974, 978, 980, 988, 994, 998}; (f[#] = -1) & /@ lst;

%t lst = {8, 32, 64, 128, 216, 512, 1000}; (f[#] = -2) & /@ lst; Table[ f[b], {b, 2, 1000, 2}]

%t (* Second program: *)

%t Module[{r = 83, nn = 12, s = {}, k}, Do[If[b > r, Break[], Do[If[Set[k, b^m/2] > r, Break[], AppendTo[s, k]], {m, 3, Infinity, 2}]], {b, 2, Infinity, 2}]; Table[If[MemberQ[s, n], -2, SelectFirst[Range[0, nn], PrimeQ[(2 n)^(2^#) + 1] &] /. x_ /; MissingQ@ x -> -1], {n, r}]] (* _Michael De Vlieger_, Jul 04 2017, Version 10.2 *)

%Y Cf. A056993, A079706, A084712, A070265, A126032.

%K sign,hard

%O 1,4

%A Yves Gallot (galloty(AT)wanadoo.fr) and _Robert G. Wilson v_, Aug 14 2013

%E Definition rewritten by _Jeppe Stig Nielsen_, Jul 02 2017