|
|
A007547
|
|
Number of steps to compute n-th prime in PRIMEGAME (slow version).
(Formerly M5075)
|
|
7
|
|
|
19, 69, 281, 710, 2375, 3893, 8102, 11361, 19268, 36981, 45680, 75417, 101354, 118093, 152344, 215797, 293897, 327571, 429229, 508284, 556494, 701008, 809381, 990746, 1274952, 1435957, 1531854, 1712701, 1820085, 2021938, 2835628, 3107393, 3549288, 3723821
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,1
|
|
REFERENCES
|
D. Olivastro, Ancient Puzzles. Bantam Books, NY, 1993, p. 21.
N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
|
|
LINKS
|
|
|
MAPLE
|
a:= proc(n) option remember; local l, p, m, k;
l:= [17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23,
77/19, 1/17, 11/13, 13/11, 15/2, 1/7, 55/1]:
if n=1 then b(0):= 2; a(0):= 0 else a(n-1) fi;
p:= b(n-1);
for m do for k while not type(p*l[k], integer) do od;
p:= p*l[k];
if 2^ilog2(p)=p then break fi
od:
b(n):= p;
m + a(n-1)
end:
|
|
MATHEMATICA
|
Clear[a]; a[n_] := a[n] = Module[{l, p, m, k}, l = {17/91, 78/85, 19/51, 23/38, 29/33, 77/29, 95/23, 77/19, 1/17, 11/13, 13/11, 15/2, 1/7, 55/1}; If[n == 1, b[0] = 2; a[0] = 0, a[n-1]]; p = b[n-1]; For[m=1, True, m++, For[k=1, !IntegerQ[p*l[[k]]], k++]; p = p*l[[k]]; If[2^(Length[IntegerDigits[p, 2]]-1) == p, Break[]]]; b[n] = p; m + a[n-1]]; Table[Print[a[n]]; a[n], {n, 1, 30}] (* Jean-François Alcover, Nov 25 2014, after Alois P. Heinz *)
|
|
PROG
|
(Haskell)
import Data.List (elemIndices)
a007547 n = a007547_list !! n
a007547_list = tail $ elemIndices 2 $ map a006530 a007542_list
|
|
CROSSREFS
|
|
|
KEYWORD
|
easy,nonn,nice
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|