OFFSET
1,4
COMMENTS
A prime number of the form b^(2^k) + 1 is called a generalized Fermat prime to base b.
See the hyperlink for more information and links.
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
LINKS
Robert G. Wilson v, Table of n, a(n) for n = 1..500
Lucile and Yves Gallot, Welcome to the Generalized Fermat Prime Search!
MATHEMATICA
f[b_?EvenQ] := f[b] = Block[{k = 0}, While[! PrimeQ[b^(2^k) + 1], k++]; k];
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;
lst = {8, 32, 64, 128, 216, 512, 1000}; (f[#] = -2) & /@ lst; Table[ f[b], {b, 2, 1000, 2}]
(* Second program: *)
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 *)
CROSSREFS
KEYWORD
sign,hard
AUTHOR
Yves Gallot (galloty(AT)wanadoo.fr) and Robert G. Wilson v, Aug 14 2013
EXTENSIONS
Definition rewritten by Jeppe Stig Nielsen, Jul 02 2017
STATUS
approved