Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Problem 2147. Langston's Ant

Created by Richard Zapor

The Langston's Ant Challenge is to determine the number of Black squares after K Ant moves.

An infinite white board has an Ant at the center. Direction is not required.

Movement and Affect:

1) At a white square, turn 90° right, White goes to Black, move forward one unit
2) At a black square, turn 90° left, Black goes to White, move forward one unit

After a given number of moves how many Black squares are present.

Input: K, number of moves from 100 to 12000

Output: BLK, number of Black squares

Example: K=5, BLK=3 [00000;00010;00110]

Note: After 11000 moves a pattern emerges

Problem Group

Solution Statistics

36 correct solutions 5 incorrect solutions
Last solution submitted on Jan 23, 2015

Problem Comments

Solution Comments