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.

Showing 1-10 of 16 results. Next

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.

Original entry on oeis.org

1, 9, 45, 55, 99, 297, 703, 999, 2223, 2728, 4879, 4950, 5050, 5292, 7272, 7777, 9999, 17344, 22222, 38962, 77778, 82656, 95121, 99999, 142857, 148149, 181819, 187110, 208495, 318682, 329967, 351352, 356643, 390313, 461539, 466830, 499500, 500500, 533170
Offset: 1

Views

Author

Keywords

Comments

4879 and 5292 are in this sequence but not in A053816.
Digital root is either 1 or 9. - Ezhilarasu Velayutham, Jul 27 2019
Named after the Indian recreational mathematician Dattatreya Ramchandra Kaprekar (1905-1986). - Amiram Eldar, Jun 19 2021
The term a(11) = 4879 is the first not in subsequence A053816. - M. F. Hasler, Mar 28 2025

Examples

			703 is a Kaprekar number because 703 = 494 + 209, 703^2 = 494209.
		

References

  • D. R. Kaprekar, On Kaprekar numbers, J. Rec. Math., Vol. 13 (1980-1981), pp. 81-82.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, NY, 1986, p. 151.

Crossrefs

See A053816 for another version.
Cf. A193992 (where 10^n-1 occurs in A006886), A194232 (first differences).
Subsequence of A248353.

Programs

  • Haskell
    -- See A194218 for another version
    a006886 n = a006886_list !! (n-1)
    a006886_list = 1 : filter chi [4..] where
       chi n = read (reverse us) + read (reverse vs) == n where
           (us,vs) = splitAt (length $ show n) (reverse $ show (n^2))
    -- Reinhard Zumkeller, Aug 18 2011
    
  • Mathematica
    (* 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. *)
    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 *)
    kaprQ[\[Nu]_] := Module[{n = \[Nu]^2},
      MemberQ[Plus @@ # & /@
        Select[Table[{Floor[n/10^j], 10^j*FractionalPart[n/10^j]}, {j,
           IntegerLength@n - 1}], #[[2]] != 0 &], \[Nu]]];
    Select[Range@1000000, kaprQ] (* Hans Rudolf Widmer, Oct 22 2021 *)
  • 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
    
  • Python
    def is_A006886(n):
        m=1; return (N:=n**2)and any(n==sum(divmod(N,m:=m*10))!=m for _ in str(N))
    print(upto_1e5 := [n for n in range(10**5)if is_A006886(n)]) # M. F. Hasler, Mar 28 2025

Formula

a(n) = A194218(n) + A194219(n) and A194218(n) concatenated with A194219(n) gives a(n)^2. - Reinhard Zumkeller, Aug 19 2011

Extensions

More terms from Michel ten Voorde, Apr 11 2001
4879 and 5292 added by Larry Reeves (larryr(AT)acm.org), Apr 24 2001
38962 added by Larry Reeves (larryr(AT)acm.org), May 23 2002

A053816 Another version of the Kaprekar numbers (A006886): 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 and n an m-digit number.

Original entry on oeis.org

1, 9, 45, 55, 99, 297, 703, 999, 2223, 2728, 4950, 5050, 7272, 7777, 9999, 17344, 22222, 77778, 82656, 95121, 99999, 142857, 148149, 181819, 187110, 208495, 318682, 329967, 351352, 356643, 390313, 461539, 466830, 499500, 500500, 533170, 538461, 609687, 643357
Offset: 1

Views

Author

Keywords

Comments

Consider an m-digit number n. Square it and add the right m digits to the left m or m-1 digits. If the resultant sum is n, then n is a term of the sequence.
4879 and 5292 are in A006886 but not in this version.
Shape of plot (see links) seems to consist of line segments whose lengths along the x-axis depend on the number of unitary divisors of 10^m-1 which is equal to 2^w if m is a multiple of 3 or 2^(w+1) otherwise, where w is the number of distinct prime factors of the repunit of length m (A095370). w for m = 60 is 20, whereas w <= 15 for m < 60. This leads to the long segment corresponding to m = 60. - Chai Wah Wu, Jun 02 2016
If n*(n-1) is divisible by 10^m-1 then n is a term where m is the number of decimal digits in n. - Giorgos Kalogeropoulos, Mar 27 2025

Examples

			703 is Kaprekar because 703 = 494 + 209, 703^2 = 494209.
		

References

  • D. R. Kaprekar, On Kaprekar numbers, J. Rec. Math., 13 (1980-1981), 81-82.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, NY, 1986, p. 151.

Crossrefs

Programs

  • Haskell
    a053816 n = a053816_list !! (n-1)
    a053816_list = 1 : filter f [4..] where
       f x = length us - length vs <= 1 &&
             read (reverse us) + read (reverse vs) == x
             where (us, vs) = splitAt (length $ show x) (reverse $ show (x^2))
    -- Reinhard Zumkeller, Oct 04 2014
    
  • Mathematica
    kapQ[n_]:=Module[{idn2=IntegerDigits[n^2],len},len=Length[idn2];FromDigits[ Take[idn2,Floor[len/2]]]+FromDigits[Take[idn2, -Ceiling[len/2]]]==n]; Select[Range[540000],kapQ] (* Harvey P. Dale, Aug 22 2011 *)
    ktQ[n_] := ((x = n^2) - (z = FromDigits[Take[IntegerDigits[x], y = -IntegerLength[n]]]))*10^y + z == n; Select[Range[540000], ktQ] (* Jayanta Basu, Aug 04 2013 *)
    Select[Range[540000],Total[FromDigits/@TakeDrop[IntegerDigits[#^2], Floor[ IntegerLength[ #^2]/2]]] ==#&] (* The program uses the TakeDrop function from Mathematica version 10 *) (* Harvey P. Dale, Jun 03 2016 *)
    maxDigits=6; Flatten[Table[lst={};sub=Subsets@FactorInteger[v=10^d-1]; Do[a=Times@@Power@@@s; n=ChineseRemainder[{0,1},{a,v/a},1]; If[10^(d-1)<=n<10^d,AppendTo[lst,n]],{s,sub}];Union@lst,{d,maxDigits}]] (* Giorgos Kalogeropoulos, Mar 27 2025 *)
  • PARI
    isok(n) = n == vecsum(divrem(n^2, 10^(1+logint(n, 10)))); \\ Ruud H.G. van Tol, Jun 02 2024
    
  • Python
    def is_A053816(n): return n==sum(divmod(n**2,10**len(str(n)))) and n
    print(upto_1e5:=list(filter(is_A053816, range(10**5)))) # M. F. Hasler, Mar 28 2025

Extensions

More terms from Michel ten Voorde, Apr 11 2001

A045913 Kaprekar numbers: numbers k such that k = q + r and k^2 = q*10^m + r, for some m >= 1, q >= 0 and 0 <= r < 10^m. Here q and r must both have the same number of digits.

Original entry on oeis.org

1, 9, 45, 55, 703, 4950, 5050, 7272, 7777, 77778, 82656, 318682, 329967, 351352, 356643, 390313, 461539, 466830, 499500, 500500, 533170, 538461, 609687, 643357, 648648, 670033, 681318, 791505, 812890, 818181, 851851, 857143, 4444444, 4927941, 5072059, 5555556, 11111112, 36363636, 38883889, 44363341, 44525548, 49995000, 50005000
Offset: 1

Views

Author

Keywords

Comments

A variant of Kaprekar's original definition (A006886).

Examples

			703 is Kaprekar because 703 = 494 + 209, 703^2 = 494209.
11111112^2 = 123456809876544 = (1234568 + 9876544)^2. The two "halves" of the square have the same length here, although it's not m but rather m - 1.
		

References

  • D. R. Kaprekar, On Kaprekar numbers, J. Rec. Math., 13 (1980-1981), 81-82.
  • D. Wells, The Penguin Dictionary of Curious and Interesting Numbers, Penguin Books, NY, 1986, p. 151.

Crossrefs

Extensions

More terms from Michel ten Voorde, Apr 13 2001
Definition clarified by Reinhard Zumkeller, Oct 05 2014
Definition modified and terms corrected by Max Alekseyev, Aug 06 2017

A053394 The full list of 3-Kaprekar numbers.

Original entry on oeis.org

1, 297, 703, 999
Offset: 1

Views

Author

N. J. A. Sloane, Jan 07 2000

Keywords

Crossrefs

A053395 Complete list of 4-Kaprekar numbers.

Original entry on oeis.org

1, 2223, 2728, 4950, 5050, 7272, 7777, 9999
Offset: 1

Views

Author

N. J. A. Sloane, Jan 07 2000

Keywords

Crossrefs

A053396 The full list of 5-Kaprekar numbers.

Original entry on oeis.org

1, 4879, 17344, 22222, 77778, 82656, 95121, 99999
Offset: 1

Views

Author

N. J. A. Sloane, Jan 07 2000

Keywords

Crossrefs

A053397 The full list of 6-Kaprekar numbers.

Original entry on oeis.org

1, 5292, 38962, 142857, 148149, 181819, 187110, 208495, 318682, 329967, 351352, 356643, 390313, 461539, 466830, 499500, 500500, 533170, 538461, 609687, 643357, 648648, 670033, 681318, 791505, 812890, 818181, 851851, 857143, 961038, 994708, 999999
Offset: 1

Views

Author

N. J. A. Sloane, Jan 07 2000

Keywords

Crossrefs

A274833 6-white numbers: partition digits of n^6 into blocks of 6 starting at right; sum of these 6-digit numbers equals n.

Original entry on oeis.org

0, 1, 1208494, 1358344, 1415583, 1538460, 1734265, 1773226, 1818180, 1994707, 2155140, 2187108, 2208493, 2215486, 2272725, 2272726, 2311687, 2318680, 2351350, 2356641, 2358343, 2363634, 2390311, 2402596, 2420874, 2449252, 2454544, 2459835, 2481220, 2500498, 2533168
Offset: 1

Views

Author

Paolo P. Lava, Jul 08 2016

Keywords

Comments

Three pairs of consecutive terms: 2272725 and 2272726; 2999997 and 2999998; 3272724 and 3272725.

Examples

			1208494^6 = 3115064124992224583219040254156270656 and 3 + 115064 + 124992 + 224583 + 219040 + 254156 + 270656 = 1208494.
		

Crossrefs

Programs

  • Maple
    P:=proc(q,h) local a,b,n;
    for n from 0 to q do a:=n^h; b:=0; while a>0 do b:=b+(a mod 10^h); a:=trunc(a/10^h); od;
    if n=b then print(n); fi; od; end: P(10^6,6);
  • Mathematica
    k = 6; Select[Range[0, 10^7], Function[n, Total[FromDigits /@ Partition[PadLeft[#, Length@ # + k - Mod[Length@ #, k]], k]] == n &@ IntegerDigits[n^k]]] (* Michael De Vlieger, Jul 08 2016, after Harvey P. Dale at A037045 *)

A274834 7-white numbers: partition digits of n^7 into blocks of 7 starting at right; sum of these 7-digit numbers equals n.

Original entry on oeis.org

0, 1, 11111110, 13477450, 20483494, 22705717, 24588560, 25411435, 26522546, 27150160, 27150161, 27777775, 28261271, 28744768, 28888885, 28888886, 29372382, 29372383, 29516500, 29855879, 31111109, 31738723, 32078101, 32222218, 32705716, 32849833, 33189212, 33333331
Offset: 1

Views

Author

Paolo P. Lava, Jul 08 2016

Keywords

Comments

Seven pairs of consecutive numbers: 27150160 and 27150161; 28888885 and 28888886; 29372382 and 29372383; 35555551 and 35555552; 37777774 and 37777775; 40483492 and 40483493; 41111107 and 41111108.
Two sets of three consecutive numbers: 34444440, 34444441 and 34444442; 39999995, 39999996 and 39999997.

Examples

			11111110^7 = 20907501177620218737880174500399224623868710000000 and
2 + 0907501 + 1776202 + 1873788 + 0174500 + 3992246 + 2386871 + 0000000 = 11111110.
		

Crossrefs

Programs

  • Maple
    P:=proc(q,h) local a,b,n;
    for n from 0 to q do a:=n^h; b:=0; while a>0 do b:=b+(a mod 10^h); a:=trunc(a/10^h); od;
    if n=b then print(n); fi; od; end: P(10^6,7);

A333133 7-Kaprekar numbers.

Original entry on oeis.org

1, 627615, 4444444, 4927941, 5072059, 5555556, 9372385, 9999999
Offset: 1

Views

Author

Eric Fox, Mar 09 2020

Keywords

Comments

No n-Kaprekar number k can have more than n digits because then the number to the left of the plus sign would have more digits than k itself, meaning the sum will always be greater than k.

Examples

			627615 is in this sequence because inserting a + before the 7th digit from the right of 627615^2 = 393900588225 yields 39390 + 0588225, which equals 627615 (the starting number).
		

Crossrefs

Showing 1-10 of 16 results. Next