prev • index • info

code guessing, round #111, stage 1 (writing)

started at . submit by

specification

the guessers have nowhere to go. it's time to build a city. submissions may be written in any language.

OEIS recently added their 400,000th sequence. to celebrate, they selected a sequence by committee to give it the number A400000. the winner, which originally was A399633, was the city-building sequence.

the rules for this sequence are simple. each entry represents the height of a building. the city-building sequence is the unique sequence such that each building is the shortest building that can see as many buildings to its left as it is tall. buildings are simple straight vertical lines across an infinite floor in a Euclidean plane; one building "seeing" another simply means there is a line between the tops of the two buildings that isn't interrupted by a building in between. tangents are acceptable, which will be important later.

let's start the sequence. since there are no buildings yet, we can start with a building of height 0. there's nothing to its left for it to be able to see, so it sees 0 buildings, satisfying the criterion. the next building is necessarily able to see the previous building, as there's nothing to get in the way, so it has to be height 1. the building after can be a 1, since it's blocked from being able to see the 0-height building by the first 1-height building. so the first 3 entries are 0, 1, 1. but we're going to have to build a taller building now, as now we have a problem. remember how I said tangents are acceptable? if we tried to add another 1, the second 1-height building would be insufficient to block the line of sight to the first one, so the new building would be able to see 2 other buildings, not just 1. we have to make the building height 2, as there's no way to build a building that can't see both buildings. (except one of height 0, but it's already clear we can never build another one of those again, because it will always be able to see the building immediately preceding it)

the first 20 terms of this sequence, A400000, are the following:

0, 1, 1, 2, 1, 2, 1, 3, 1, 2, 1, 3, 1, 2, 1, 10, 1, 2, 2, 3

your challenge is to enumerate the entries of this sequence, one way or another. as any language is allowed, there is no fixed API.

entries

0 entries have been received so far.

submit