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
...
...
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
...
...
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
Nice one :P
I don't get it
Staying away from General.
Say the code out loud and notice how what you say relates to the code before it.
i still don't get it
I finally get it!
-MethodMan-
Your Move:Life is a game, Play it; Life is a challenge, Meet it; Life is an opportunity, capture it.
Homepage: http://www.freewebs.com/andy_moog/home.html
TELL ME
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
Last edited by SlyMaelstrom; 12-24-2005 at 02:10 AM.
Sent from my iPadŽ
I Still Don't Get It. Ive Been Reading It Over For Half An Hour
Erm, they say this gives you the patternWant 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)
Last edited by SirCrono6; 12-24-2005 at 04:41 PM.
From C to shining C++!
Great graphics, sounds, algorithms, AI, pathfinding, visual effects, cutscenes, etc., etc. do NOT make a good game.
- Bubba
IDE and Compiler - Code::Blocks with MinGW
Operating System - Windows XP Professional x64 Edition
Well, thanks for the crystal clear code.
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
11Originally Posted by h_howee
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...
"Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
-Christopher Hitchens
Nearly identical (well, same idea) to an ACM problem for this year's competition.
http://acm.fit.edu/icpc/ser2005/problems/K_number.pdf
{RTFM, KISS}