login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A097099
Smallest k>0 such that (2^k)*A002110(n) - 1 is prime.
2
1, 1, 1, 1, 2, 6, 1, 1, 2, 3, 12, 1, 2, 22, 2, 4, 13, 12, 6, 1, 4, 1, 4, 9, 2, 9, 5, 6, 2, 1, 9, 17, 22, 7, 19, 73, 23, 12, 5, 27, 33, 64, 33, 5, 7, 41, 44, 35, 29, 3, 19, 6, 26, 5, 11, 9, 33, 34, 16, 63, 46, 8, 4, 24, 48, 32, 11, 29, 26, 6, 25, 17, 31, 6, 46, 33, 46, 17, 8, 61, 12, 23, 76
OFFSET
1,5
MATHEMATICA
f[n_] := Block[{k = 1, p = Product[Prime[i], {i, n}]}, While[ !PrimeQ[2^k*p - 1], k++ ]; k]; Table[ f[n], {n, 83}] (* Robert G. Wilson v, Sep 27 2004 *)
kp[n_]:=Module[{k=1}, While[!PrimeQ[2^k n-1], k++]; k]; With[{prmrls=Rest[ FoldList[Times, 1, Prime[Range[90]]]]}, kp/@prmrls] (* Harvey P. Dale, Feb 01 2012 *)
PROG
(PFGW & SCRIPT)
Command pfgw64 -f in.txt
in.txt file = SCRIPT file
SCRIPT
DIM n, 0
DIM i, 0
DIM pp
DIMS t
OPENFILEOUT myf, a(n).txt
LABEL loop1
SET n, n+1
SET i, 0
LABEL loop2
SET i, i+1
SETS t, %d, %d, %d\,; n; p(n); i
SET pp, (2^i)*p(n)#-1
PRP pp, t
IF ISPRP THEN GOTO a
GOTO loop2
LABEL a
WRITE myf, t
GOTO loop1
CROSSREFS
Sequence in context: A244814 A090185 A059813 * A316622 A197111 A065529
KEYWORD
nonn
AUTHOR
Pierre CAMI, Sep 15 2004
EXTENSIONS
More terms from Robert G. Wilson v, Sep 27 2004
STATUS
approved