## Prime number CA?

For discussion of other cellular automata.
Rich Holmes
Posts: 55
Joined: October 31st, 2015, 1:13 am

### Prime number CA?

Today, Nov 3 (11/3 or 11/03 or 3/11), is the 307th day of 2015. And 3, 11, 113, 1103, 311, and 307 are all prime. Ignore Amazon, THIS is PrimeDay. (But next year it's March 11, because 308 is not prime, but 71 is.)﻿

Which is why I was googling for "prime number" "cellular automata" and found this: http://www.njohnston.ca/2009/08/generat ... e-of-life/, wherein in the comments Andrew Trevorrow wrote:
Nathaniel, in case you haven’t seen this, download http://myweb.tiscali.co.uk/calcy/life/simulators.zip, install Primes.table and .colors in Golly’s rules folder and then load primer.rle. This is a 2-cell(!) pattern that emulates Dean’s primer Life pattern using a 10-state rule.
Which looks pretty interesting... but the link is dead. Anyone know where I could find this?

danieldb
Posts: 163
Joined: July 15th, 2015, 4:27 pm
Location: Right behind you holding a knife
Contact:

### Re: Prime number CA?

Rich Holmes wrote:Which looks pretty interesting... but the link is dead. Anyone know where I could find this?

Code: Select all

``````@RULE Primer

A 10-state rule that supports a 2-cell prime number generator.
It uses a similar principle to Dean Hickerson's "Primer" pattern,
only 60 times faster. The sieves remove every multiple of
each integer, except for that integer.

Calcyman (Adam P. Goucher), 18 May 2009

@TABLE

n_states:10
neighborhood:Moore
symmetries:none

#State 0: Empty Space
#State 1: Up spaceship
#State 2: Down spaceship
#State 3: Up spaceship on reflector
#State 4: Down spaceship on reflector
#State 5: Reflector
#State 6: Reflector in initial state
#State 7: NW spaceship
#State 8: E puffer
#State 9: SE puffer

var a={0,1,2,3,4,5,6,7,8,9}
var b={0,1,2,3,4,5,6,7,8,9}
var c={0,1,2,3,4,5,6,7,8,9}
var d={0,1,2,3,4,5,6,7,8,9}
var e={0,1,2,3,4,5,6,7,8,9}
var f={0,1,2,3,4,5,6,7,8,9}
var g={0,1,2,3,4,5,6,7,8,9}
var h={0,1,2,3,4,5,6,7,8,9}

var i={2,4}
var j={1,3,6}

var k={0,1,2,4,5,6,7,8,9}

0,i,a,b,c,d,e,f,g,2
5,i,a,b,c,d,e,f,g,3
0,a,b,c,d,j,e,f,g,1
5,a,b,c,d,j,e,f,g,4

0,a,b,k,7,c,d,e,f,7

0,9,a,b,c,d,e,f,g,7

8,a,b,c,d,e,f,g,h,5
9,a,b,c,d,e,f,g,h,6
0,9,a,b,c,d,e,f,g,7

0,a,b,c,d,e,f,8,g,8
0,a,b,c,d,e,f,g,9,9

1,a,b,c,d,e,f,g,h,0
2,a,b,c,d,e,f,g,h,0
7,a,b,c,d,e,f,g,h,0

3,a,b,c,d,e,f,g,h,5
4,a,b,c,d,e,f,g,h,5
6,a,b,c,d,e,f,g,h,5

@COLORS

1 255 0 0
2 0 255 0
3 255 128 128
4 128 255 128
5 128 128 128
6 192 192 192
7 128 128 255
8 128 255 255
9 255 255 128``````
The pattern is here:

Code: Select all

``````x = 1, y = 3, rule = Primer
H2\$I!
``````
moved to drc

Rich Holmes
Posts: 55
Joined: October 31st, 2015, 1:13 am

### Re: Prime number CA?

Excellent, thank you!

Rich Holmes
Posts: 55
Joined: October 31st, 2015, 1:13 am

### Re: Prime number CA?

Ah, now I see it's in the Golly patterns folder too.

Rich Holmes
Posts: 55
Joined: October 31st, 2015, 1:13 am

### Re: Prime number CA?

Also there's a paper here https://forge.info.unicaen.fr/attachmen ... primes.pdf I. Korec, "Real time generation of primes by a one dimensional cellular automaton with 9 states". I couldn't find a rules file so I made one.

Code: Select all

``````@RULE Odp

One dimensional prime generator

I. Korec, "Real time generation of primes by a one dimensional cellular automaton with 9 states"

Leftmost non-empty cell is in state 3 in generation t if t is prime, else in state 2.

@TABLE

n_states: 9
neighborhood: oneDimensional
symmetries: none

0,0,0,0 ...:.
0,0,1,1 ../:/
0,0,2,0 ..0:.
0,0,3,0 ..1:.
0,0,4,4 ..L:L
0,0,5,0 ..R:.
0,0,7,0 ..V:.
0,0,6,1 ..r:/
0,0,8,1 ..v:/
1,0,0,0 ./.:.
1,0,1,1 .//:/
1,0,3,1 ./1:/
1,0,4,4 ./L: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