cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

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.

Original entry on oeis.org

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

Views

Author

David W. Wilson, Feb 05 2001

Keywords

Comments

The sequence is finite with last term a(114) = 149, see link and b-file. - Reinhard Zumkeller, Jan 06 2014

Crossrefs

Another decimal analog of A059458. See A059497 for primes that are missed. Cf. A059471, A059498.
Cf. A010051.

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