The card trick 21 cards are taken from which viewer selects one card The 21 cards are divided into 3 piles Viewer identifies pile in which selected card is present That pile is kept below all other piles and 21 cards are divided into 3 piles again(left to right distribution) Process is repeated 3 more times Second card from top is taken in last step IT IS THE SELECTED CARD!! CARD TRICK OR MATH TREAT
DEFINITION OF VARIABLES N Total no. of cards C no. of cards in each pile w Position of the card in the pile (from top) P total no. of piles S no. of steps
1) First position of card A is w in pile k 2) one division - pile k is kept below all other piles and N cards are divided into P piles What is the position of card A now in the pile? It is [ (C –w) / P] + 1
if Card A is in w position from top in pile k then there are (C-w) cards below it. new pos P … (1) 2P … P+1 (2). (m+1)P.. (C-w) …. mP+1 (m+1) So if C-w lies in (m+1) row, not extreme card, new pos m +1 [(C-w)/P] +1 If C-w = (m+1)P then new pos m+2 [(C-w)/P] +1
FUNCTION DEFINITION f : {1,2,…C} {1,2….C} such that f(w) = [( C– w)/P]+1
PROPERTIES OF FUNCTION 1) f is decreasing function 2) f(a) = a and f(b)=b a = b
3) if x(1) x(2) x3 …..x(n) x(1) (all x(i) distinct) then n = 1 or 2 only Case1) x(1)<x(2) and x(1)<x(3) Position (inc order) (position after div) x(1).. x(2).. x(3).. x(4).. x(n).. x(1).. x(4).. x(5).. x(2).. x(3).. Col 1-inc Col 2 -dec ( f is dec) so x(3)<x(1). Contradiction. Similarly other cases proved
4) f(x)=y and f(y)=x (x!=y) f(a)!=a for any a proof: suppose there is a where f(a)=a. wlog we can assume x<y since f is decreasing,x<a<y is the only possibility. [(C-x)/p]+1=y & [(C-y)/p]+1=x & [(C-a)/p]+1=a C=(y-1)p+x+k 1 =(x-1)p+y+k 2 =(a-1)p+a+k 3 (for some k i in Z) (y-x)p=y-x+k 1 -k 2 =>(y-x)(p-1)=k 1 -k 2 LHS>0 =>p-1/k 1 -k 2 this is possible if k 1 =p-1 and k 2 =0 y=x+1 But x<a<y.so contradiction arises.
5) the no. of steps are infinite iff f(a)!=a for any a 1) ( if f(a) != a then infinite no. of steps) 1 x y z…. C 1 x y….. So always, at any step f(1)!=f(C) 2) ( if infinite no. of steps then f(a) != a) if there exist x, y x-->y-->x then from (4) f(a)!=a if no such x,y exists then from 3, established that no cycle > 2 is present. Hence system is finite 6) if f(a)=a,the final position occupied by the card is a proof: f(a)=a x y x doesnt exist from (4,5) if any system x(0) x(1) …..x(C-1).. Is finite then f (x(C-1)) = x(C-1) = a ( from 2) hence all no.s 1,2,3,4…C finally go to a thus a is the final position
RESULTS 1)The card trick can be performed if f(a)=a for some a belonging to {1,2,3..C} 2)final position of card will be a 3)Comp prog given below prints no. of steps and the final position of the card
SOME EXAMPLES P C final pos steps infi