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.

A065031 In the decimal expansion of n, replace each odd digit with 1 and each even digit with 2.

Original entry on oeis.org

2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21, 12, 11, 12, 11, 12, 11, 12, 11, 12, 11, 22, 21, 22, 21, 22, 21, 22, 21, 22, 21
Offset: 0

Views

Author

Santi Spadaro, Nov 03 2001

Keywords

Comments

A196563(a(n)) = A196563(n); A196564(a(n)) = A196564(n).

Examples

			a(123)=121 because 1 and 3 are odd and 2 is even.
		

Programs

  • Haskell
    a065031 n = f n  where
       f x | x < 10    = 2 - x `mod` 2
           | otherwise = 10 * (f x') + 2 - m `mod` 2
           where (x',m) = divMod x 10
    -- Reinhard Zumkeller, Feb 22 2012
  • Mathematica
    Table[FromDigits[If[OddQ[#],1,2]&/@IntegerDigits[n]],{n,0,120}] (* Harvey P. Dale, Jun 08 2014 *)