Cut the knot: learn to enjoy mathematics
A math books store at a unique math study site. Shopping at the store helps maintain the site. Thank you.
Learning Math Online
Sites for teachers
Sites for parents
Terms of use
Awards
Interactive Activities

CTK Exchange
CTK Wiki Math
CTK Insights - a blog
Math Help

III Millennium Olympiad

Games & Puzzles
What Is What
Arithmetic/Algebra
Geometry
Probability
Outline Mathematics
Make an Identity
Book Reviews
Stories for Young
Eye Opener
Analog Gadgets
Inventor's Paradox
Did you know?...
Proofs
Math as Language
Things Impossible
Visual Illusions
My Logo
Math Poll
Cut The Knot!
MSET99 Talk
Other Math sites
Front Page
Movie shortcuts
Personal info
Privacy Policy

Guest book
News sites

Recommend this site

Games to relax

Sites for teachers
Sites for parents

Education & Parenting

Manifesto  |  Bookstore  |  Contents  |  Amazon store  |  Term index  |  What changed?  |  Contact  |  Recommend
RSS Feed: Recent changes at CTK

Sieve of Squares

A slight modification of the Sieve of Eratosthenes produces an interesting result. Write integers from 1 through a given number N in order. Originally, all the numbers are typed in blue and are enclosed in squares. Proceed in steps. On a step #k, change the color of all multiples of k (including k itself) from blue to red or from red to blue as the case may be. The red numbers are circled. Perform N steps, from 1 through N. What numbers will be red and circled?

In the applet below, pay attention to the button at the bottom of the applet, initially labelled "1". "1" indicates the first step. Click on the button. The first step will be performed, and the label on the button will change to "2" - a sign that the applet is ready for the next step, etc.


This applet requires Sun's Java VM 2 which your browser may perceive as a popup. Which it is not. If you want to see the applet work, visit Sun's website at http://www.java.com/en/download/index.jsp, download and install Java VM and enjoy the applet.


Buy this applet
What if applet does not run?

The factors of a number come in pairs: A = n·m. This shows that the effect of actions on steps #n and #m cancel out so long as the factors n and m are different. If A is a complete square, A = n·n, the step #n is still performed, but only once, which causes A to be red when the process stops.

I first noticed this problem in [Winkler, p. 13], but then ran into it in [Engel, p. 41 as an exercise. Winkler sets up the problem in a locker room where coming students lock/unlock the lockers to confirm with the above problem. Engel's setup is quite different. He does not present a solution. Instead, he urges the reader to perform the sieve:

 

In the central prison of Sikinia there are n cells numbered 1 to n, each occupied by a single prisoner. The state of each cell can be changed from closed to open and vice versa by a half-turn of the key. To celebrate the Centennial Anniversary of the Republic it was decided to grant a partional amnesty. The president sent an officer to the prison with the instruction:

  for i:=1 to n do
  turn the keys of cells i, 2i, 3i, ... .

A prisoner was freed if at the end his door was open. Which prisoners are set free? Remark: Do not think, just sieve!

References

  1. A. Engel, Exploring Mathematics with Your Computer, MAA, 1993
  2. P. Winkler, Mathematical Puzzles: A Connoisseur's Collection, A K Peters, 2004 (Locker doors puzzle)

Copyright © 1996-2009 Alexander Bogomolny

34221649Page copy protected against web site content infringement by Copyscape


Search:
Keywords:

Google
Web CTK