login
A194218
Left part of the square of the n-th Kaprekar number.
3
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,2
COMMENTS
a(n) + A194219(n) = A006886(n) and
concatenation of a(n) and A194219(n) = A006886(n)^2.
LINKS
Rosetta Code, Kaprekar numbers
Eric Weisstein's World of Mathematics, Kaprekar Number
Wikipedia, Kaprekar number
PROG
(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.
CROSSREFS
Sequence in context: A022757 A246308 A365145 * A339273 A017617 A246309
KEYWORD
nonn,base
AUTHOR
Reinhard Zumkeller, Aug 19 2011
STATUS
approved