Maths Olympiad Prep

Library / HMMT February /342 of 1302

HMMT February

Number theory Difficulty 5.0 AIME, harder Find the answer

(Lucas Numbers) The Lucas numbers are defined by L0=2,L1=1L_{0}=2, L_{1}=1, and Ln+2=Ln+1+LnL_{n+2}=L_{n+1}+L_{n} for every n≥0n \geq 0. There are NN integers 1≤n≤20161 \leq n \leq 2016 such that LnL_{n} contains the digit 1 . Estimate NN.

A number or a short expression. Fractions can be typed as 3/2, and spacing doesn't matter.

Solution

```
Answer: 1984
lucas_ones n = length . filter (elem '1') take(n+1)lucasstrswherelucas=2:1:zipWith(+)lucas(taillucas)lucasstrs=mapshowlucasmain=putStrLn.show take (n + 1) lucas_strs where lucas = 2 : 1 : zipWith (+) lucas (tail lucas) lucas_strs = map show lucas main = putStrLn . show lucas_ones 2016
```

Want a route through all this instead of an archive? The track puts 2,604 problems in a working order, from Junior Challenge level to the IMO shortlist.

Source: Omni-MATH, licensed Apache-2.0. Statement reproduced verbatim; metadata (topic, difficulty) added by this project.