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.

A194218 Left part of the square of the n-th Kaprekar number.

Original entry on oeis.org

1, 8, 20, 30, 98, 88, 494, 998, 494, 744, 238, 2450, 2550, 28, 5288, 6048, 9998, 3008, 4938, 1518, 60494, 68320, 90480, 99998, 20408, 21948, 33058, 35010, 43470, 101558, 108878, 123448, 127194, 152344, 213018, 217930, 249500, 250500, 284270, 289940, 371718
Offset: 1

Views

Author

Reinhard Zumkeller, Aug 19 2011

Keywords

Comments

a(n) + A194219(n) = A006886(n) and
concatenation of a(n) and A194219(n) = A006886(n)^2.

Programs

  • Haskell
    import Data.List (find)
    import Data.Maybe (mapMaybe)
    a194218 n = a194218_list !! (n-1)
    a194218_list = map fst kaprekarPairs
    a194219 n = a194219_list !! (n-1)
    a194219_list = map snd kaprekarPairs
    a006886 n = a006886_list !! (n-1)
    a006886_list = map (uncurry (+)) kaprekarPairs
    kaprekarPairs = (1,0) : (mapMaybe (\n -> kSplit n $ splits (n^2)) [1..])
       where kSplit x = find (\(left, right) -> left + right == x)
             splits q = no0 . map (divMod q) $ iterate (10 *) 10
             no0 = takeWhile ((> 0) . fst) . filter ((> 0) . snd)
    -- Cf. Rosetta link.