%I #68 Oct 07 2019 14:08:46
%S 3,2,1,1,2,2,5,12,14,10,33,39,174,16,95,39,413,619,949,514,2221,3842,
%T 2676,2356,5588,8580,2437,7853,14337,26004,1282,72089,42375,24609,
%U 82176,124121,289450,713933,321445,730784,3073601
%N a(n) is the cyclic length of the iterative sequence f(k) = prime(f(k-1) mod 2^n) with f(0) = 1.
%C Each iterative sequence is cyclic since there is a finite number of primes less than 2^k. Therefore a(n) <= A007053(n).
%e For n=2, the seq. is 1, 2, 3, 5, 2, 3, 5, 2, 3, 5, 2, 3, 5, ..., ; which cycles every 3 terms;
%e for n=3, the seq. is 1, 2, 3, 5, 11, 5, 11, 5, 11, 5, 11, 5, ... ; which cycles every 2 terms;
%e for n=4, the seq. is 1, 2, 3, 5, 11, 31, 47, 47, 47, ..., ; which cycles every term;
%e for n=5, the seq. is 1, 2, 3, 5, 11, 31, 127, 127, 127, ..., ; which cycles every term;
%e for n=6, the seq. is 1, 2, 3, 5, 11, 31, 127, 307, 233, 179, 233, 179, 233, ..., ; which cycles every 2 terms;
%e for n=7, the seq. is 1, 2, 3, 5, 11, 31, 127, 709, 347, 467, 431, 211, 431, 211, 431, ..., ; which cycles every 2 terms;
%e for n=8, the seq. is 1, 2, 3, 5, 11, 31, 127, 709, 1201, 1051, 103, 563, 233, 1471, 1153, 727, 1319, 167, 991, 1409, 727, 1319, 167, 991, 1409, ..., ; which cycles every 5 terms;
%e for n=9, the seq. is 1, 2, 3, 5, 11, 31, 127, 709, 1201, 1051, 103, 563, 233, 1471, 3163, 467, 3319, 1567, 127, 709, 1201, 1051, 103, 563, 233, 1471, 3163, 467, 3319, 1567, 127, ..., ; which cycles every 12 terms;
%e for n=10, the seq. is 1, 2, 3, 5, 11, 31, 127, 709, 5381, 1663, 4733, 4723, 4643, 3943, 6763, 4567, 3343, 1741, 5431, 2063, 47, 211, 1297, 1753, 5519, 2731, 5107, 8039, 6763, 4567, 3343, 1741, 5431, 2063, 47, 211, 1297, 1753, 5519, 2731, 5107, 8039, 6763, ..., ; which cycles every 14 terms;
%e for n=11, the seq. is 1, 2, 3, 5, 11, 31, 127, 709, 5381, 10501, 1663, 14107, 15601, 10313, 367, 2477, 2971, 7219, 8629, 3049, 7927, 15271, 7333, 9629, 11981, 14867, 3823, 15199, 6691, 3943, 16339, 17417, 8233, 179, 1063, 8527, 2251, 1237, 10079, 16231, 16339, 17417, 8233, 179, 1063, 8527, 2251, 1237, 10079, 16231, 16339, 17417, 8233, 179, 1063, 8527, 2251, 1237, 10079, 16231, 16339, 17417, 8233, 179, 1063, 8527, 2251, 1237, 10079, 16231, 16339; which cycles every 10 terms;
%e ... as n-> inf. the seq. is 1, 2, 3, 5, 11, 31, 127, 709, 5381, 52711, 648391, ..., .
%t f[n_] := Block[{s = NestWhileList[ Prime[ Mod[#, 2^n]] &, 1, UnsameQ, All]}, s = -Subtract @@ Position[s, s[[-1]]]; s[[1]]]
%Y Cf. A007097, A128867.
%K nonn,more
%O 2,1
%A _Robert G. Wilson v_, Sep 13 2019
%E a(35) corrected and a(37)-a(41) added by _Chai Wah Wu_, Oct 02 2019
%E a(42) from _Chai Wah Wu_, Oct 07 2019