A059496 a(1) = 2; a(n+1) is obtained by and trying to change just one digit of a(n), starting with the least significant digit, until a new prime is reached. Take the lexicographically earliest sequence. Digits may be replaced by any nonzero digit.
2, 3, 5, 7, 17, 11, 13, 19, 29, 23, 43, 41, 47, 37, 31, 61, 67, 97, 197, 191, 193, 199, 139, 131, 137, 127, 157, 151, 181, 281, 283, 223, 227, 229, 239, 233, 263, 269, 569, 563, 523, 521, 541, 547, 557, 577, 571, 271, 277, 257, 251, 211, 241, 641, 643, 647, 617, 613, 619
Offset: 1
Links
- Reinhard Zumkeller, Table of n, a(n) for n = 1..114
- Reinhard Zumkeller, Proof of finiteness
Crossrefs
Programs
-
Haskell
a059496 n = a059496_list !! (n-1) a059496_list = 2 : f [2] [2] where f qs xs = g candidates where g [] = [] g (ys:yss) | a010051 q == 0 || q `elem` qs = g yss | otherwise = q : f (q:qs) ys where q = foldr (\d r -> 10 * r + d) 0 ys candidates = [us ++ [z] ++ vs | i <- [0 .. length xs - 1], let (us, (_:vs)) = splitAt i xs, z <- [1..9]] ++ [xs ++ [z] | z <- [1..9]] -- Reinhard Zumkeller, Jan 06 2014
Comments