Logo

Greetings from The On-Line Encyclopedia of Integer Sequences!

Hints

Search: id:A074890
Displaying 1-1 of 1 results found. page 1
     Format: long | short | internal | text      Sort: relevance | references | number      Highlight: on | off
A074890 Decimal form of binary integers produced by Wolfram's rule 30 cellular automata. +0
2
1, 3, 6, 13, 25, 55, 100, 222, 401, 891, 1602, 3559, 6428, 14258, 25647, 56936, 102860, 228154, 410339, 910998, 1645813, 3650437, 6565453, 14576121, 26332935, 58407052, 105047514, 233217299, 421327294, 934513441, 1680759539 (list; graph; listen)
OFFSET

0,2

REFERENCES

S. Wolfram, A New Kind of Science, Wolfram Media Inc., (2002), p. 27.

FORMULA

If b(n) is current binary digit, perform for each digit to get next integer in sequence: b(n) = (b(n)==0 && b(n+1)==0) ? b(n-1) : 1-b(n-1);//Wolfram's Rule 30*

EXAMPLE

a(4)=13 because a(3)=6=0110(binary) and applying rule 30 to each digit [(b(n)==0 && b(n+1)==0) ? b(n-1) : 1-b(n-1)]

PROGRAM

/**Java class to generate sequence */ public class r30seqA { static String zero="0", one="1"; public static void main(String[] args) { int base10 = 1; System.out.println(base10); for(int i=0; i<30; i++) System.out.println(base10 = base10Convert(applyR30(Integer.toBinaryString(base10)))); }

static String applyR30(String base2) { int a0, a1, a2, newDigit; StringBuffer newBase2 = new StringBuffer(); for(int i=-1; i<base2.length(); i++){ if(i<1) a0=0; else a0=base2.substring(i-1, i).equals(zero)?0:1; if(i<0) a1=0; else a1=base2.substring(i, i+1).equals(zero)?0:1; if(i==base2.length()-1) a2=0; else a2=base2.substring(i+1, i+2).equals(zero)?0:1; newDigit = a1==0&&a2==0?a0:1-a0; //Wolfram's Rule 30 newBase2.append(newDigit==0?zero:one); } return newBase2.toString(); }

static int base10Convert(String R30) { int newBase10 = 0; for(int i=0; i<R30.length(); i++) if(!R30.substring(i, i+1).equals(zero)) newBase10 += powerOf2(R30.length()-i-1); return newBase10; }

static int powerOf2(int power) { int p = 1; for(int i=0; i<power; i++) p*=2; return p; } }

CROSSREFS

Adjacent sequences: A074887 A074888 A074889 this_sequence A074891 A074892 A074893

Sequence in context: A005407 A005116 A121349 this_sequence A032198 A079941 A019300

KEYWORD

base,nonn

AUTHOR

Jason E Sackett (jason(AT)heavyion.com), Sep 13 2002

page 1

Search completed in 0.002 seconds

Lookup | Welcome | Find friends | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
More pages | Superseeker | Maintained by N. J. A. Sloane (njas@research.att.com)

Last modified October 13 20:18 EDT 2008. Contains 145016 sequences.


AT&T Labs Research