Brainy Puzzles

Puzzle Solvers: Interesting brainy puzzles shared by fellow puzzlers

405 Members

Join this group to post and comment.

# Tough Puzzle: The Parrot Sequence - crack it!

**Puzzle Taken from Mind and Visual Puzzles! -**

The parrot sequence

Gaston owns a clever parrot called Paco which can describe out loud numbers read from a piece of paper displayed in front of him. One day

Gaston tried this funny experiment: he wrote the digit 1 on a sheet and showed it to Paco, who answered “one 1”. Gaston wrote down the parrot’s answer “one 1” or ‘11’ on a new sheet and showed it to Paco, who readily answered “two 1’s”. Again, Gaston wrote down his reply “two 1’s” or ‘21’ on another sheet and showed it to Paco, who replied “one 2, one 1” or ‘1211’... Gaston continued this experiment until he obtained a long sequence of numbers 1, 11, 21, 1211, 111221, 312211, etc... in which each next term is obtained by describing the previous term.

Can you say how many sheets of paper Gaston will need until:

a) the string of digits 333 appears, or

b) the digit 4 occurs in the sequence?

Can you also confirm that the last digit of any term of the parrot sequence is always 1?

No Takers? Too tough for the CEans? 😁

1) 333 will never appear. this is because for 333 to appear, we would need 333 in the previous sequence too( we got to have 3 three's for three consecutive three's to appear. let us consider the previous sequence was x333y. this can be like x 3's and 3 3's or 3 3's and 3 y's. either way we need to have 3 3's in the previous sequence). reasoning in this way this can only happen if we start off with 3 three's which we did not(we started with 1). hence 333 can never appear.

2) 4 can never appear either. for that we would need xxxx in the previous sequence( where x is any digit). let us consider that the sequence was yxxxxz. this can be like y x's, x x's, x z's or x x's , x x's. in the first case it would rather be spelt as (x+y) x's and in the latter as 2x x's. thus a four can also never appear. in fact the max no that can appear is 3.

3) yes the last digit will always be 1. in fact the last digit will be the always be the no we started with. this can be proved again by contradiction. let the last two digits be xy(where y != 1 and x is any no). now this is actually x y's. since x !=0 , then the previous sequence would also end with a y. and the same would repeat till the first sequence. thus the last digit is always the digit we started with, in this case 1.

proved.

correct _k??

2) 4 can never appear either. for that we would need xxxx in the previous sequence( where x is any digit). let us consider that the sequence was yxxxxz. this can be like y x's, x x's, x z's or x x's , x x's. in the first case it would rather be spelt as (x+y) x's and in the latter as 2x x's. thus a four can also never appear. in fact the max no that can appear is 3.

3) yes the last digit will always be 1. in fact the last digit will be the always be the no we started with. this can be proved again by contradiction. let the last two digits be xy(where y != 1 and x is any no). now this is actually x y's. since x !=0 , then the previous sequence would also end with a y. and the same would repeat till the first sequence. thus the last digit is always the digit we started with, in this case 1.

proved.

correct _k??

*Hmm... I'd like to have a parrot that can count and that has such good hold on English grammar.*

the digits 333 never appears because the whole digits end with 1's and 2's....for 333 to appear the prev digits shud also be the same ..so its not at all possible

Good one.....................big_K.............

give us dome more

give us dome more

Mahul's explanation is good 😀

Can anyone write a psudo code for this? like give 15 sequences. or 30 sequences etc? 😁

I tore my hair out while trying to write it in Python...good one! give moreee!

Can anyone write a psudo code for this? like give 15 sequences. or 30 sequences etc? 😁

I tore my hair out while trying to write it in Python...good one! give moreee!

I think I got you, but still I would like to confirm. Are you asking us to write a code that generates the parrot sequence?? Maybe take the initial input would be provided by the user?

Yes that. And hell, it can be difficult for new programmers like me. I havent used C for so long. Presently i am on Python.

Actually, just today I wrote the draft code for the parrot seq.

Next step is to take any input and keep writing till sequences are complete.

Yea, so try to write the code. This can be a competition too. We can have coding competitions 😀 In the end we can upload these files on celab.tk for ppl to download and test. 😀 Code will be reveled LATER.

Actually, just today I wrote the draft code for the parrot seq.

Next step is to take any input and keep writing till

Yea, so try to write the code. This can be a competition too. We can have coding competitions 😀 In the end we can upload these files on celab.tk for ppl to download and test. 😀 Code will be reveled LATER.

break the number, count (by parsing) and display

Here is the program for Parrot sequence. I tried it in Java.

Here is the one I tried. Its written on Python.

It was basically made as a demo for future Crazyengineers software distributions. Contains Installation with CE logo, desktop Icon, Start menu item etc.

Download it from:

Name of Program is:

It was basically made as a demo for future Crazyengineers software distributions. Contains Installation with CE logo, desktop Icon, Start menu item etc.

Download it from:

**cecode - Google Code**Name of Program is:

**CE_ParrotProgie.exe**#include int main() { long count(long); long n,result; int choice; clrscr(); printf("Give the initial number to parrot PACO(Default:1) :"); scanf("%d",&n); do { result=count(n); printf("PACO's count :%ld\n",result); printf("Do you want to continue ?(1/0) :"); scanf("%d",&choice); if(choice==1) n=result; }while(choice==1); getch(); return 0; } long count(long n) { long reverse(long); long result=0,rev=reverse(n); int currentDigit=0,newDigit=0,temporaryResult=0,count=0; currentDigit=rev%10; while(rev>0) { newDigit=rev%10; if(newDigit==currentDigit) { switch(newDigit) { case 1: case 2: case 3: case 4: case 5: case 6: case 7: case 8: case 9: case 0:count=count+1;break; } currentDigit=newDigit; rev=rev/10; } else{ temporaryResult=count*10+currentDigit; result=result*100+temporaryResult; currentDigit=newDigit; count=0; } } temporaryResult=count*10+newDigit; result=result*100+temporaryResult; return(result); } long reverse(long n) { int remainder; long reverse=0; while(n>0) { remainder=n%10; reverse=reverse*10+remainder; n=n/10; } return(reverse); }

wow, C and Java. have to read it though 😀

**Check out another one**

The link to the puzzle is : Funny Ball Game

Many people tried and nobody found a solution to this.

It is a puzzle between human and computer.

Post here if you beat the computer.

You cant beat the computer. There are 21 balls and you can pick upto 4 balls at a time. So, the strategy is to pick in multiples of 5, so that after 20, only one ball remains.

So, you start. If you pick 1, the computer picks 4. If you pick 2, computer picks 3 and so on. So, as long as you pick first, you cant win no matter how you play. If the computer picks first, then by the same strategy, you can win.

So, you start. If you pick 1, the computer picks 4. If you pick 2, computer picks 3 and so on. So, as long as you pick first, you cant win no matter how you play. If the computer picks first, then by the same strategy, you can win.

silverscorpionYou cant beat the computer. There are 21 balls and you can pick upto 4 balls at a time. So, the strategy is to pick in multiples of 5, so that after 20, only one ball remains.

So, you start. If you pick 1, the computer picks 4. If you pick 2, computer picks 3 and so on. So, as long as you pick first, you cant win no matter how you play. If the computer picks first, then by the same strategy, you can win.

Awesome. Really Awesome.

4 number will appear on 10th term. i.e. the term on position 10 which will be 132113124113112211

a) The sequence 333 never appears.

b)The digit 4 occurs at the 11 page .

b)The digit 4 occurs at the 11 page .

4 will not appear at any costThe_Big_KPuzzle Taken from Mind and Visual Puzzles! -

The parrot sequence

Gaston owns a clever parrot called Paco which can describe out loud numbers read from a piece of paper displayed in front of him. One day

Gaston tried this funny experiment: he wrote the digit 1 on a sheet and showed it to Paco, who answered “one 1”. Gaston wrote down the parrot’s answer “one 1” or ‘11’ on a new sheet and showed it to Paco, who readily answered “two 1’s”. Again, Gaston wrote down his reply “two 1’s” or ‘21’ on another sheet and showed it to Paco, who replied “one 2, one 1” or ‘1211’... Gaston continued this experiment until he obtained a long sequence of numbers 1, 11, 21, 1211, 111221, 312211, etc... in which each next term is obtained by describing the previous term.

Can you say how many sheets of paper Gaston will need until:

a) the string of digits 333 appears, or

b) the digit 4 occurs in the sequence?

Can you also confirm that the last digit of any term of the parrot sequence is always 1?

4 doesnt occur at any page..sidd26b)The digit 4 occurs at the 11 page .

it goes only with 1,2 and 3 in all the pages.

yes, every time the last digit is 1.