Jump to content
BrainDen.com - Brain Teasers
Sign in to follow this  
phil1882

recursive numbering

1 post in this topic

found this interesting idea on the web over at xkcd.

<number> := <prime>
<number> := <composite>
<composite> := <number> <number>
<prime> := 1
<prime> := 'p' '(' <composite> ')'
<prime> := 'p' <prime>

then the first 20 numbers are:

1

p1

pp1

p1p1

ppp1

pp1p1

p(p1p1)

p1p1p1

pp1pp1

p1ppp1

pppp1

p1p1pp1

p(p1pp1)

p1p(p1p1)

pp1ppp1

p1p1p1p1

pp(p1p1)

p1pp1pp1

p(p1p1p1)

p1p1ppp1

can you generate the next 20?

 

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×