Jump to content
BrainDen.com - Brain Teasers

recursive numbering


phil1882
 Share

Recommended Posts

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?

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...