Search for a tool
Conway Sequence

Tool to generate Conway sequences. The Conway Sequence is a sequence of digits (also called Look-and-Say sequence) invented by mathematician John H. Conway. Each term is made of the reading of the digits (the number of consecutive digits) of the previous term.

Results

Conway Sequence -

Tag(s) : Mathematics,Fun

dCode and you

dCode is free and its tools are a valuable help in games, puzzles and problems to solve every day!
You have a problem, an idea for a project, a specific need and dCode can not (yet) help you? You need custom development? Contact-me!


Team dCode read all messages and answer them if you leave an email (not published). It is thanks to you that dCode has the best Conway Sequence tool. Thank you.

This page is using the new English version of dCode, please make comments !

Conway Sequence

Sponsored ads

Next Look-and-Say Term




Conway Sequence Generator


Also on dCode:

Tool to generate Conway sequences. The Conway Sequence is a sequence of digits (also called Look-and-Say sequence) invented by mathematician John H. Conway. Each term is made of the reading of the digits (the number of consecutive digits) of the previous term.

Answers to Questions

How does the Conway Sequence works?

To generate the next term in the sequence, it must use the previous one, read it digit by digit and locate the numbers that are repeated consecutively. The sequence usually begins with 1 first term (also called seed).

1 reads a 1 is 11

11 reads as two 1 or 21

21 reads as one 2 and one 1 so 1211

1211 reads one 1, one 2 and two 1 so 111221

111221 is three 1, two 2 and one 1 is 312211 and so on..

The Conway sequence is 1, 11, 21, 1211, 111221, 312211, 13112221, 1113213211, ...`

What are the variants of the Conway Sequence?

The Conway sequence is set to begin with 1 by default, but it is possible to consider a different seed.

For a seed g of 2,3,4,5,6,7,8,9 or 0, these values are obtained:

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.

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.

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.

1, 11, 21, 1211, 3112, 132112, 311322, 232122, 421311, 14123113 ...

The Conway sequence is similar to run-length encoding.

How to code Conway in Javascript?

// Yves PRATTER
// Version 1.0 - 2011/11/07
function previousConway(t) {
r = "";
// impossible
if (t.length%2 == 1) return r;
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;
}

Ask a new question

Source code

dCode retains ownership of the source code of the script Conway Sequence. Except explicit open source licence (free / freeware), any algorithm, applet, software (converter, solver, encryption / decryption, encoding / decoding, ciphering / deciphering, translator), or any snippet or function (convert, solve, decrypt, encrypt, decipher, cipher, decode, code, translate) written in PHP (or Java, C#, Python, Javascript, etc.) which dCode owns rights can be transferred after sales quote. So if you need to download the Conway Sequence script for offline use, for you, your company or association, see you on contact page !

Questions / Comments


Team dCode read all messages and answer them if you leave an email (not published). It is thanks to you that dCode has the best Conway Sequence tool. Thank you.


Source : http://www.dcode.fr/conway-sequence
© 2016 dCode — The ultimate 'toolkit' website to solve every problem. dCode