02.28
Solve this progression.
”
[15:45] chris: haha, give that a go: 1 11 21 1211 111221
”
Differencing:
=============
proves useless…
go:
1 0 0 0 0 0 0 11 10 10 10 10 10 10 21 10 0 -10 20 10 0 1211 1190 1180 1180 1190 1170 1160 111221 110010 108820 107640 106460 105270 104100
Patternized:
============
Attempt 1:
———-
1 - added 1 11 - added 1 to the end or the start 21 - replaced the first of 2 1's with a 2. 1211 - added 1 to the start, and then end 111221 - added 2 1's to the start, and performed op 3.
1. Always add a 1 to the start
2. for each pair of 1′s replace the left inner most with a 2.
1 11 21 1211 - fails.
Attempt 2:
———-
The fact that number |2| == |3| and |n| mod 2 == 0 except for 1 means that concatenation may not be relevant, or may be based upon some internal pattern.
Is the number of 2′s relavant to the number of 1′s?
: 1's d1 dd1 2's d2 dd2 length dl 1 - 1 0 0 0 0 0 1 0 11 - 2 1 1 0 0 0 2 1 21 - 1 -1 2 1 1 1 2 0 1211 - 3 2 3 1 0 -1 4 2 111221 - 4 1 1 2 1 1 6 2 -
|n| changes irrespective of creation of a 2. 2′s are added every 2 rounds.
NOTE FROM CHRIS: “[16:17] chris: there is one pattern that you have to observe.”
NOTE FROM CHRIS: “[16:18] chris: try reading the pattern out, i seem to remember that helping.”
one one one two one one two one one one one one two two one
one eleven twenty-one twelve eleven eleven twelve twenty-one
Attempt 3:
———-
By column…
1 11 21 1211 111221 ^ | fails here.
Attempt 4:
———-
How many 1′s around the 2′s?
:1 on the end 1 at start 1 - 1 1 11 - 2 2 21 - 1 0 1211 - 2 1 111221 - 1 3
Attempt 5:
———-
Totals…
1 1 11 2 21 3 1211 6 111221 8
Damnit….
[16:50] james tucker: yeah sorry i see
Ok, the solution:
—————–
one one one two one(s) one two, one one one one, one two, two one(s) three one(s), two two(s), one one
A Maths fucntion to solve it:
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)
That function scares me.
me too
Well, it is aprently an interview question… I guess they want you to derive this function in one hour on a white board
http://commoninterview.com/story.php?title=numbers-puzzle
Some ruby to do it: