Just for the fun of it

For the Compleat Fan
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Just for the fun of it

Post by newdep »

Just for the fun of it, I ran into it again and its still a funny puzzle..
(a nice one to make in newlisp btw !)

The puzzle is: What is the next number in the following sequence:

1 11 21 1211 111221 312211 13112221


PS: For those who know the answer, dont post the number after 13112221
but post the number after that one ;-)
-- (define? (Cornflakes))

Sammo
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Post by Sammo »

Shouldn't the sequence be this?

Code: Select all

> 1
1
> (next 1)
"11"
> (next (next 1))
"21"
> (next (next (next 1)))
"1211"
> (next (next (next (next 1))))
"1231"
> (next (next (next (next (next 1)))))
"131221"
> (next (next (next (next (next (next 1))))))
"132231"
> (next (next (next (next (next (next (next 1)))))))
"232221"
> (next (next (next (next (next (next (next (next 1))))))))
"134211"
> (next (next (next (next (next (next (next (next (next 1)))))))))
"14131231"
[Edit: Sorry, I was thinking of a different sequence.]

Sammo
Posts: 180
Joined: Sat Dec 06, 2003 6:11 pm
Location: Loveland, Colorado USA

Post by Sammo »

This is more like it:

Code: Select all

> "1"
"1"
> (next "1")
"11"
> (next (next "1"))
"21"
> (next (next (next "1")))
"1211"
> (next (next (next (next "1"))))
"111221"
> (next (next (next (next (next "1")))))
"312211"
> (next (next (next (next (next (next "1"))))))
"13112221"
> ;...

> (next (next (next (next (next (next (next (next "1"))))))))
"31131211131221"

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

thats intresting.... though im losing track after the 3th nested list ;-)

When i saw the puzzle i was directly thinking of your Roman-Number
script "http://www.newlisp.org/syntax.cgi?code/roman.lsp.txt".

Your solution is correct, thought only in your second answer ;-)
31131211131221 is the 9th sequence..

Your first answer does produce an intresting sequence, cant figure out
yet what it could be ;-)

Regards, Norman.
-- (define? (Cornflakes))

Locked