PDA

View Full Version : Puzzle!!!

Barnzey
12-05-2005, 03:43 PM
Hi all got a puzzle for you!

Find the next two lines of the following sequence:

11
21
12-11
11-12-21
31-22-11
13-11-22-21
11-13-21-32-11
...
...

Rouss
12-05-2005, 04:00 PM
They had something like this on the Google test and the python challenge...

11
21
12-11
11-12-21
31-22-11
13-11-22-21
11-13-21-32-11

31-13-12-11-13-12-21

13-21-13-11-13-31-13-11-22-11

Barnzey
12-06-2005, 04:51 AM
Nice one :P

Cheeze-It
12-06-2005, 08:10 AM
I don't get it

PJYelton
12-06-2005, 10:01 AM
Say the code out loud and notice how what you say relates to the code before it.

h_howee
12-23-2005, 11:53 PM
i still don't get it

MethodMan
12-24-2005, 12:03 AM
I finally get it! :)

h_howee
12-24-2005, 12:35 AM
TELL ME

SlyMaelstrom
12-24-2005, 02:04 AM
If you're having trouble with this, I'll white out a hint for you all.

Read out the numbers one digit at a time:

11
21
12-11
11-12-21
31-22-11
13-11-22-21
11-13-21-32-11

One One
Two One
One Two One One
One One One Two Two One
Three One Two Two One One
One Three One One Two Two Two One
One One One Three Two One Three Two One One

Now compare each string to the previous line and look for a connection.

...and also if you're looking at Rouss' solution and not seeing a connection, note that he was slightly off. It should be:

11
21
12-11
11-12-21
31-22-11
13-11-22-21
11-13-21-32-11

31-13-12-11-13-12-21

13-21-13-11-12-31-13-11-22-11

h_howee
12-24-2005, 02:11 PM
:( I Still Don't Get It. Ive Been Reading It Over For Half An Hour :(

SirCrono6
12-24-2005, 02:33 PM
Want more math? If you think that the sequence is "non-mathematical", I derived this mathematical expression that gives the sequence... have fun! (D is a recursive function and t is the term number.) It's a lot easier if you think verbally, isn't it?

By the way, % here is a certain non-integer remainder function. 2.1%0.1 would be 0, 2.1%0.2 would be 0.1, 2.1%0.3 would be 0 since 0.3 fits evenly into 2.1, etc.) If you really want conventional operators, you could define % with limits and modular arithmetic...

D(t+1) = (sigma(K=1,LOG(D(t)*10)-LOG(D(t)*10)%1,((D(t)-D(t)%10^(LOG(D(t))-
LOG(D(t))%1)+sigma(S=1,LOG(D(t))-LOG(D(t))%1,(((sigma(R=1,LOG(D(t)*10)
-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*
10%10^R)%10^(R+1)))/10)-(sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*
10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)
%10^(S-1))%10^S+1)%(((sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)
*10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)-(
sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%10
^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)%10^(S-1))%10^S+.5)*2*(D(t)
-D(t)%10^(S-1))%10^S))-(D(t)-D(t)%10^(LOG(D(t))-LOG(D(t))%1)+sigma(S=1,
LOG(D(t))-LOG(D(t))%1,(((sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)
*10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)
-(sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%
10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)%10^(S-1))%10^S+1)%(((
sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%
10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)-(sigma(R=1,LOG(D(t)*
10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*
10-D(t)*10%10^R)%10^(R+1)))/10)%10^(S-1))%10^S+.5)*2*(D(t)-D(t)%10^(S
-1))%10^S))%10^(K-1))%10^K/10^(K-1)*100^(2*sigma(N=1,K,(((D(t)-D(t)%
10^(LOG(D(t))-LOG(D(t))%1)+sigma(S=1,LOG(D(t))-LOG(D(t))%1,(((sigma(R=1,
LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%10^(R+2)/10-
(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)-(sigma(R=1,LOG(D(t)*10)-LOG(D(t)*
10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%
10^(R+1)))/10)%10^(S-1))%10^S+1)%(((sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%
1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%
10^(R+1)))/10)-(sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)
*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)%10^(S-1))
%10^S+.5)*2*(D(t)-D(t)%10^(S-1))%10^S))-(D(t)-D(t)%10^(LOG(D(t))-LOG(D(t))
%1)+sigma(S=1,LOG(D(t))-LOG(D(t))%1,(((sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)
%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^
(R+1)))/10)-(sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%
10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)%10^(S-1))%10^
S+1)%(((sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%10^
(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)-(sigma(R=1,
LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%10^(R+2)/
10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)%10^(S-1))%10^S+.5)*2*(D(t)-D(t)%
10^(S-1))%10^S))%10^(N-1))%10^N+1)%(((D(t)-D(t)%10^(LOG(D(t))-LOG(D(t))%
1)+sigma(S=1,LOG(D(t))-LOG(D(t))%1,(((sigma(R=1,LOG(D(t)*10)-LOG(D(t)*
10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^
R)%10^(R+1)))/10)-(sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-
D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)%10^
(S-1))%10^S+1)%(((sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-
D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)-
(sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%
10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)%10^(S-1))%10^S+.5)*2*
(D(t)-D(t)%10^(S-1))%10^S))-(D(t)-D(t)%10^(LOG(D(t))-LOG(D(t))%1)+
sigma(S=1,LOG(D(t))-LOG(D(t))%1,(((sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10
)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^
R)%10^(R+1)))/10)-(sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*
10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/
10)%10^(S-1))%10^S+1)%(((sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,
ABS((D(t)*10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%
10^(R+1)))/10)-(sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*
10-D(t)*10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))
/10)%10^(S-1))%10^S+.5)*2*(D(t)-D(t)%10^(S-1))%10^S))%10^(N-1))%10^
N+.5))))/100)+(sigma(K=1,LOG(D(t)*10)-LOG(D(t)*10)%1,100^(1+sigma(N=
1,K-1,2*((((sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*
10%10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)-(
sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%
10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)%10^(N-1))%10^N/10^(N-
1)+1)%(((sigma(R=1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%
10^(R+1))%10^(R+2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)-(sigma(R=
1,LOG(D(t)*10)-LOG(D(t)*10)%1-1,ABS((D(t)*10-D(t)*10%10^(R+1))%10^(R+
2)/10-(D(t)*10-D(t)*10%10^R)%10^(R+1)))/10)%10^(N-1))%10^N/10^(N-1)+
.5)))))/10)

Erm, they say this gives you the pattern :p

dwks
12-24-2005, 04:20 PM
Well, thanks for the crystal clear code.

h_howee
12-28-2005, 11:26 PM
:( :(

hk_mp5kpdw
12-29-2005, 06:46 AM
:( :(

11

There are 2 1's here so we then write:

21

There is 1 2 followed by 1 1 so we write:

12-11

There is 1 1 followed by 1 2 followed by 2 1's so we write:

11-12-21

And so on and so on...

spoon_
12-30-2005, 12:34 PM
Nearly identical (well, same idea) to an ACM problem for this year's competition.

http://acm.fit.edu/icpc/ser2005/problems/K_number.pdf