Tool to generate Conway sequences, a sequence of digits (also called Look-and-Say) where each term is made of the reading of the digits of the previous term.
Conway Sequence - dCode
Tag(s) : Mathematics, Fun/Miscellaneous
dCode is free and its tools are a valuable help in games, maths, geocaching, puzzles and problems to solve every day!
A suggestion ? a feedback ? a bug ? an idea ? Write to dCode!
The Conway sequence, also known as the look-and-say sequence, is a sequence of integers that is constructed by describing the digits or groups of digits present in the previous sequence. It was discovered by British mathematician John Horton Conway.
To generate the next term in the sequence, use the previous one, by reading it digit by digit and grouping the numbers that are repeated consecutively. The sequence usually begins with 1 first term (also called seed).
Example:
Term | Is read | Is written |
---|---|---|
1 | one 1 | 11 |
11 | two 1s | 21 |
21 | one 2 and one 1 | 1211 |
1211 | one 1, one 2 and two 1s | 111221 |
111221 | three 1s, two 2s and 1 | 312211 |
The Conway sequence is 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, … (and is often used as a riddle, a logic sequence, where the player must guess the next term)
Conway's sequence is also known as the audioactive suite or look and say sequence.
The sequence with seed 1 contains only the digits 1, 2 and 3.
All terms begin with 1 or 3 except the 3rd.
Reductio ad absurdum (assuming the seed does not contain 333):
Suppose that 333 appears for the first time at term n, then the term n-1 must also contain 333 (_333 or 333_ can only appear with a series of three 3 in the previous term). Contradiction, the hypothesis is false, so 333 never appears.
If the term n contained a digit greater than 3, it must come from more than 3 (i.e. 4 or more) equal consecutive digits in the term n-1 which never happens.
It should be noted that by using a seed containing 4 or containing a repetition of 4 digits, then it is possible to generate Conway sequences with additional digits, including the digit 4.
The Conway sequence is set to begin with 1 by default, but it is possible to use a different seed.
Example: For a seed g of 2,3,4,5,6,7,8,9 or 0, the sequence obtained is g, 1g, 111g, 311g, 13211g, 111312211g … (the seed is always at the end).
It is possible to use slightly different rules:
— Read the previous term and count all occurrences of numbers, listed in ascending order.
Example: 1, 11, 21, 1112, 3112, 211213, 312213, 212223, 114213, 31121314, 41122314, …
— Read the previous term and count all occurrences of numbers, listed in descending order.
Example: 1, 11, 21, 1211, 1231, 131221, 132231, 232221, 134211, 14131231, 14231241, …
— Read the previous term and count all occurrences of numbers, listed in order of appearance.
Example: 1, 11, 21, 1211, 3112, 132112, 311322, 232122, 421311, 14123113 …
The Conway sequence is similar to run-length encoding.
This sequence has been invented and analyzed by famous mathematician John H. Conway also known for developing The Game of Life.
// Yves PRATTER
// Version 1.0 - 2011/11/07
function previousConway(t) {
r = "";
if (t.length%2 == 1) return r;// impossible
idx = 0;
while (idx < t.length){
for(i=0; i < t.charAt(idx); i++) { r += t.charAt(idx+1); }
idx += 2;
}
return r;
}
function conway(t) {
if (t == "") return "0";
r = "";
idx = 0;
while (idx < t.length){
for(i=1; t.charAt(idx+i) == t.charAt(idx); i++) {}
r += i + t.charAt(idx);
idx += i;
}
return r;
}
dCode retains ownership of the "Conway Sequence" source code. Any algorithm for the "Conway Sequence" algorithm, applet or snippet or script (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, breaker, translator), or any "Conway Sequence" functions (calculate, convert, solve, decrypt / encrypt, decipher / cipher, decode / encode, translate) written in any informatic language (Python, Java, PHP, C#, Javascript, Matlab, etc.) or any database download or API access for "Conway Sequence" or any other element are not public (except explicit open source licence like Creative Commons). Same with the download for offline use on PC, mobile, tablet, iPhone or Android app.
Reminder: dCode is an educational and teaching resource, accessible online for free and for everyone.
The content of the page "Conway Sequence" and its results may be freely copied and reused, including for commercial purposes, provided that dCode.fr is cited as the source.
Exporting the results is free and can be done simply by clicking on the export icons ⤓ (.csv or .txt format) or ⧉ (copy and paste).
To cite dCode.fr on another website, use the link:
In a scientific article or book, the recommended bibliographic citation is: Conway Sequence on dCode.fr [online website], retrieved on 2025-04-16,