The integer numbers from $1$ to $2002$ are written in a blackboard in increasing order $1,2,\ldots, 2001,2002$. After that, somebody erases the numbers in the $ (3k+1)-th$ places i.e. $(1,4,7,\dots)$. After that, the same person erases the numbers in the $(3k+1)-th$ positions of the new list (in this case, $2,5,9,\ldots$). This process is repeated until one number remains. What is this number?
Problem
Source: Spanish Communities
Tags: number theory unsolved, number theory
27.05.2006 07:15
int a[2003],i,j; for(i=1;i<=2002;i++)a[i]=i; while(n>3){n=0; for(i=1;i<=2002;i+=3)a[i]=0; //erase numbers for(i=1;i<=2002;i++) if(a[i]!=0&&a[i-1]==0) {n++; j=i; while(!a[j--]);a[j]=a[i];a[i]=0 } //moves numbers together after erase //and counts numbers } //now one should just //show a to see the last 2 numbers
27.09.2008 22:49
2,5,9... ? Why? 2,6,10..?
25.09.2012 07:23
It is actually 2,6,10. Working backwards we can reach the desired number.