OFFSET
1,1
COMMENTS
Conway's PRIMEGAME produces the terms 2^prime in increasing order.
From Daniel Forgues, Jan 20 2016: (Start)
Pairs (n, a(n)) such that a(n) = 2^k are (1, 2^1), (20, 2^2), (70, 2^3), (282, 2^5), (711, 2^7), (2376, 2^11), (3894, 2^13), (8103, 2^17), ...
Numbers n such that a(n) = 2^k are 1, 20, 70, 282, 711, 2376, 3894, 8103, ... [This is 1 + A007547. - N. J. A. Sloane, Jan 25 2016] (End)
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
Alois P. Heinz, Table of n, a(n) for n=1..8103
J. H. Conway, FRACTRAN: a simple universal programming language for arithmetic, in T. M. Cover and Gopinath, eds., Open Problems in Communication and Computation, Springer, NY 1987, pp. 4-26.
Richard K. Guy, Conway's prime producing machine, Math. Mag. 56 (1983), no. 1, 26-33. [Gives slightly different version of the program which produces different terms, starting from n=132.]
OEIS Wiki, Conway's PRIMEGAME
Kevin I. Piterman and Leandro Vendramin, Computer algebra with GAP, 2023. See p. 40.
Leandro Vendramin, Mini-couse on GAP - Exercises, Universidad de Buenos Aires (Argentina, 2020).
Eric Weisstein's World of Mathematics, FRACTRAN
Wikipedia, FRACTRAN
FORMULA
a(n+1) = A203907(a(n)), a(1) = 2. [Reinhard Zumkeller, Jan 24 2012]
MAPLE
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=1 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=1..50); # Alois P. Heinz, Aug 12 2009
MATHEMATICA
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[1] = 2; A007542[n_] := A007542[n] = (p = A007542[n - 1]; k = 1; While[ ! IntegerQ[p * conwayFracs[[k]]], k++]; p * conwayFracs[[k]]); Table[A007542[n], {n, 42}] (* Jean-François Alcover, Jan 23 2012, after Alois P. Heinz *)
PROG
(Haskell)
a007542 n = a007542_list !! (n-1)
a007542_list = iterate a203907 2 -- Reinhard Zumkeller, Jan 24 2012
(Python)
from fractions import Fraction
nums = [17, 78, 19, 23, 29, 77, 95, 77, 1, 11, 13, 15, 1, 55] # A202138
dens = [91, 85, 51, 38, 33, 29, 23, 19, 17, 13, 11, 2, 7, 1] # A203363
PRIMEGAME = [Fraction(num, den) for num, den in zip(nums, dens)]
def succ(n, program):
for i in range(len(program)):
if (n*program[i]).denominator == 1: return (n*program[i]).numerator
def orbit(start, program, steps):
orb = [start]
for s in range(1, steps): orb.append(succ(orb[-1], program))
return orb
print(orbit(2, PRIMEGAME, steps=42)) # Michael S. Branicky, Feb 15 2021
CROSSREFS
KEYWORD
AUTHOR
STATUS
approved