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.

A006886 Kaprekar numbers: positive numbers n such that n = q+r and n^2 = q*10^m+r, for some m >= 1, q >= 0 and 0 <= r < 10^m, with n != 10^a, a >= 1.

This page as a plain text file.
%I A006886 M4625 #146 Mar 29 2025 18:28:22
%S A006886 1,9,45,55,99,297,703,999,2223,2728,4879,4950,5050,5292,7272,7777,
%T A006886 9999,17344,22222,38962,77778,82656,95121,99999,142857,148149,181819,
%U A006886 187110,208495,318682,329967,351352,356643,390313,461539,466830,499500,500500,533170
%N A006886 Kaprekar numbers: positive numbers n such that n = q+r and n^2 = q*10^m+r, for some m >= 1, q >= 0 and 0 <= r < 10^m, with n != 10^a, a >= 1.
%C A006886 4879 and 5292 are in this sequence but not in A053816.
%C A006886 Digital root is either 1 or 9. - _Ezhilarasu Velayutham_, Jul 27 2019
%C A006886 Named after the Indian recreational mathematician Dattatreya Ramchandra Kaprekar (1905-1986). - _Amiram Eldar_, Jun 19 2021
%C A006886 The term a(11) = 4879 is the first not in subsequence A053816. - _M. F. Hasler_, Mar 28 2025
%D A006886 D. R. Kaprekar, On Kaprekar numbers, J. Rec. Math., Vol. 13 (1980-1981), pp. 81-82.
%D A006886 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%D A006886 David Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, NY, 1986, p. 151.
%H A006886 Robert Gerbicz, <a href="/A006886/b006886.txt">Table of n, a(n) for n = 1..51514</a> [T. D. Noe computed terms 1 - 1019, Nov 10 2007; R. Gerbicz computed the first 51514 terms, Jul 28 2011]
%H A006886 Santanu Bandyopadhyay, <a href="https://www.ese.iitb.ac.in/~santanu/RM7.pdf">Kaprekar Number</a>, Indian Institute of Technology Bombay (Mumbai, India, 2020).
%H A006886 Nicholas John Bizzell-Browning, <a href="https://bura.brunel.ac.uk/handle/2438/29960">LIE scales: Composing with scales of linear intervallic expansion</a>, Ph. D. Thesis, Brunel Univ. (UK, 2024). See p. 142.
%H A006886 Ömer Eğecioğlu and Bünyamin Şahin, <a href="https://toc.ui.ac.ir/article_28781.html">On twin EP numbers</a>, Transact. Comb. (2025) Vol. 14, Iss. 4, Art. No. 4, 261-270. See p. 262, also <a href="https://www.researchgate.net/publication/384628439_On_Twin_EP_Numbers">ResearchGate</a>.
%H A006886 Shyam Sunder Gupta, <a href="https://doi.org/10.1007/978-981-97-2465-9_9">On Some Marvellous Numbers of Kaprekar</a>, Exploring the Beauty of Fascinating Numbers, Springer (2025) Ch. 9, 275-315.
%H A006886 Hans Havermann, <a href="http://chesswanks.com/seq/b006886/">The first 11 million Kaprekar numbers (plus the region around the billionth)</a>.
%H A006886 Douglas E. Iannucci, <a href="http://www.cs.uwaterloo.ca/journals/JIS/VOL3/iann2a.html">The Kaprekar Numbers</a>, Journal of Integer Sequences, Vol. 3 (2000), Article 1.2,
%H A006886 Douglas E. Iannucci and Bertrum Foster, <a href="https://cs.uwaterloo.ca/journals/JIS/VOL8/Iannucci/iannucci45.html">Kaprekar Triples</a>, Journal of Integer Sequences, Vol. 8 (2005), Article 05.4.8.
%H A006886 Robert Munafo, <a href="http://www.mrob.com/pub/seq/kaprekar.html">Kaprekar Sequences</a>.
%H A006886 Rosetta Code, <a href="http://rosettacode.org/wiki/Kaprekar_numbers">Kaprekar numbers</a>.
%H A006886 Walter Schneider, <a href="http://web.archive.org/web/2004/www.wschnei.de/digit-related-numbers/kaprekar-numbers.html">Kaprekar Numbers</a>, 2002.
%H A006886 Gérard Villemin's Almanach of Numbers, <a href="http://villemin.gerard.free.fr/Wwwgvmm/Iteration/Kaprekar.htm#Nombre">Nombres de Kaprekar</a>
%H A006886 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/KaprekarNumber.html">Kaprekar Number</a>.
%H A006886 Wikipedia, <a href="http://en.wikipedia.org/wiki/Kaprekar_number">Kaprekar number</a>.
%H A006886 <a href="/index/Coi#Colombian">Index entries for Colombian or self numbers and related sequences</a>
%F A006886 a(n) = A194218(n) + A194219(n) and A194218(n) concatenated with A194219(n) gives a(n)^2. - _Reinhard Zumkeller_, Aug 19 2011
%e A006886 703 is a Kaprekar number because 703 = 494 + 209, 703^2 = 494209.
%t A006886 (* This Mathematica code computes five additional powers in order to be sure that all the Kaprekar numbers have been computed. This fix works for mx <= 50, which includes terms computed by Gerbicz. *)
%t A006886 Inv[a_, b_] := PowerMod[a, -1, b]; mx = 20; t = {1}; Do[h = 10^k - 1; d = Divisors[h]; d2 = Select[d, GCD[#, h/#] == 1 &]; If[Log[10, h] < mx, AppendTo[t, h]]; Do[q = d2[[i]]*Inv[d2[[i]], h/d2[[i]]]; If[Log[10, q] < mx, AppendTo[t, q]], {i, 2, Length[d2] - 1}], {k, mx + 5}]; t = Union[t] (* _T. D. Noe_, Aug 17 2011, Aug 18 2011 *)
%t A006886 kaprQ[\[Nu]_] := Module[{n = \[Nu]^2},
%t A006886   MemberQ[Plus @@ # & /@
%t A006886     Select[Table[{Floor[n/10^j], 10^j*FractionalPart[n/10^j]}, {j,
%t A006886        IntegerLength@n - 1}], #[[2]] != 0 &], \[Nu]]];
%t A006886 Select[Range@1000000, kaprQ] (* _Hans Rudolf Widmer_, Oct 22 2021 *)
%o A006886 (Haskell) -- See A194218 for another version
%o A006886 a006886 n = a006886_list !! (n-1)
%o A006886 a006886_list = 1 : filter chi [4..] where
%o A006886    chi n = read (reverse us) + read (reverse vs) == n where
%o A006886        (us,vs) = splitAt (length $ show n) (reverse $ show (n^2))
%o A006886 -- _Reinhard Zumkeller_, Aug 18 2011
%o A006886 (PARI) select( {is_A006886(n)=my(N=n^2,m=1);while(N>m*=10,n==N%m+N\m && m!=n && return(m));n==1}, [1..10^5]) \\ _M. F. Hasler_, Mar 28 2025
%o A006886 (Python)
%o A006886 def is_A006886(n):
%o A006886     m=1; return (N:=n**2)and any(n==sum(divmod(N,m:=m*10))!=m for _ in str(N))
%o A006886 print(upto_1e5 := [n for n in range(10**5)if is_A006886(n)]) # _M. F. Hasler_, Mar 28 2025
%Y A006886 See A053816 for another version.
%Y A006886 Cf. A037042, A053394, A053395, A053396, A053397, A045913, A003052.
%Y A006886 Cf. A193992 (where 10^n-1 occurs in A006886), A194232 (first differences).
%Y A006886 Subsequence of A248353.
%K A006886 nonn,nice,base,easy
%O A006886 1,2
%A A006886 _Robert Munafo_
%E A006886 More terms from _Michel ten Voorde_, Apr 11 2001
%E A006886 4879 and 5292 added by Larry Reeves (larryr(AT)acm.org), Apr 24 2001
%E A006886 38962 added by Larry Reeves (larryr(AT)acm.org), May 23 2002