close
login
Successive integers produced by Conway's PRIMEGAME.
(Formerly M2084)
13

%I M2084 #92 Apr 26 2026 15:20:35

%S 2,15,825,725,1925,2275,425,390,330,290,770,910,170,156,132,116,308,

%T 364,68,4,30,225,12375,10875,28875,25375,67375,79625,14875,13650,2550,

%U 2340,1980,1740,4620,4060,10780,12740,2380,2184,408,152,92,380,230,950,575,2375

%N Successive integers produced by Conway's PRIMEGAME.

%C Conway's PRIMEGAME produces the terms 2^prime in increasing order.

%C From _Daniel Forgues_, Jan 20 2016: (Start)

%C Pairs (n, a(n)) such that a(n) = 2^k are (0, 2^1), (19, 2^2), (69, 2^3), (281, 2^5), (710, 2^7), (2375, 2^11), (3893, 2^13), (8102, 2^17), ...

%C Numbers n such that a(n) = 2^k are 0, 19, 69, 281, 710, 2375, 3893, 8102, ... [This is A007547. - _N. J. A. Sloane_, Jan 25 2016] (End)

%D D. Olivastro, Ancient Puzzles. Bantam Books, NY, 1993, p. 21.

%D N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

%H Alois P. Heinz, <a href="/A007542/b007542.txt">Table of n, a(n) for n=0..8102</a>, Jun 01 2010.

%H J. H. Conway, <a href="https://doi.org/10.1007/978-1-4612-4808-8_2">FRACTRAN: a simple universal programming language for arithmetic</a>, in T. M. Cover and Gopinath, eds., Open Problems in Communication and Computation, Springer, NY 1987, pp. 4-26.

%H Richard K. Guy, <a href="https://www.jstor.org/stable/2690263">Conway's prime producing machine</a>, Math. Mag. 56 (1983), no. 1, 26-33. [Gives slightly different version of the program which produces different terms, starting from n=132.]

%H OEIS Wiki, <a href="https://oeis.org/wiki/Conway&#39;s_PRIMEGAME">Conway's PRIMEGAME</a>

%H Kevin I. Piterman and Leandro Vendramin, <a href="https://crossroads-2023.github.io/vendramin/gap.pdf">Computer algebra with GAP</a>, 2023. See p. 40.

%H Leandro Vendramin, <a href="https://www.mun.ca/aac/AACMiniCourses/GAP/problems.pdf">Mini-couse on GAP - Exercises</a>, Universidad de Buenos Aires (Argentina, 2020).

%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/FRACTRAN.html">FRACTRAN</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/FRACTRAN">FRACTRAN</a>

%F a(n+1) = A203907(a(n)), a(0) = 2. - _Reinhard Zumkeller_, Jan 24 2012

%p 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]: a:= proc(n) option remember; global l; local p, k; if n=0 then 2 else p:= a(n-1); for k while not type(p*l[k], integer) do od; p*l[k] fi end: seq(a(n), n=0..50); # _Alois P. Heinz_, Aug 12 2009

%t conwayFracs := {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}; a[0] = 2; A007542[n_] := A007542[n] = (p = A007542[n - 1]; k = 1; While[ ! IntegerQ[p * conwayFracs[[k]]], k++]; p * conwayFracs[[k]]); Table[A007542[n], {n, 0, 42}] (* _Jean-François Alcover_, Jan 23 2012, after _Alois P. Heinz_ *)

%o (Haskell)

%o a007542 n = a007542_list !! (n-1)

%o a007542_list = iterate a203907 2 -- _Reinhard Zumkeller_, Jan 24 2012

%o (Python)

%o from fractions import Fraction

%o nums = [17, 78, 19, 23, 29, 77, 95, 77, 1, 11, 13, 15, 1, 55] # A202138

%o dens = [91, 85, 51, 38, 33, 29, 23, 19, 17, 13, 11, 2, 7, 1] # A203363

%o PRIMEGAME = [Fraction(num, den) for num, den in zip(nums, dens)]

%o def succ(n, program):

%o for i in range(len(program)):

%o if (n*program[i]).denominator == 1: return (n*program[i]).numerator

%o def orbit(start, program, steps):

%o orb = [start]

%o for s in range(1, steps): orb.append(succ(orb[-1], program))

%o return orb

%o print(orbit(2, PRIMEGAME, steps=42)) # _Michael S. Branicky_, Feb 15 2021

%o (PARI) A007542_first(N)=vector(N,i,N=if(i>1,A203907(N),2)) \\ _M. F. Hasler_, Apr 26 2026

%Y Cf. A007546, A007547, A183132, A202138, A203363.

%Y Cf. A203907 (PRIMEGAME successor function).

%K easy,nonn,look,nice

%O 0,1

%A _N. J. A. Sloane_

%E Offset changed to 0 and corresponding edits by _M. F. Hasler_, Apr 26 2026