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-7 of 7 results.

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

A228381 Unabridged sub-Kaprekar numbers (A118936, but allowing powers of ten).

Original entry on oeis.org

10, 11, 78, 100, 101, 287, 364, 1000, 1001, 1078, 1096, 1287, 1364, 10000, 10001, 11096, 18183, 100000, 100001, 118183, 336634, 1000000, 1000001, 1336634, 2727274, 10000000, 10000001, 12727274, 19138757, 23529412, 25974026, 97744361, 100000000, 100000001, 120879122
Offset: 1

Views

Author

Hans Havermann, Aug 21 2013

Keywords

Comments

Square roots of A228103.
Excluding powers-of-ten and powers-of-ten-plus-one, what remains may be arranged into pairs (x,y), y>x, where y-x is a power of ten. The x terms correspond to A118938.

Examples

			10^2 = (10-0)^2.
11^2 = (12-1)^2.
78^2 = (6-084)^2.
		

Crossrefs

Programs

  • Mathematica
    k=3; While[k<10^8, k++; s=k^2; d=IntegerDigits[s]; l=Length[d]; Do[a=FromDigits[Take[d, {1, i}]]; b=FromDigits[Take[d, {i+1, l}]]; If[k==Abs[a-b], Print[k]], {i, l-1}]]
  • PARI
    lista(nn) = my(d, s, t=1, v=List([])); while(t(x>1&&x<=nn), v)); \\ Jinyuan Wang, Jan 02 2025

A248353 Kaprekar numbers, allowing powers of 10: n such that n=q+r and n^2=q*10^m+r, for some m >= 1, q>=0 and 0<=r<10^m.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Oct 05 2014

Keywords

Comments

Powers of 10 were excluded in Kaprekar's original definition (A006886), see also A045913.

Crossrefs

Cf. A006886 (subsequence), A045913, A053816, A011557, A102766.

Programs

  • Haskell
    a248353 n = a248353_list !! (n-1)
    a248353_list = filter k [1..] where
       k x = elem x $ map (uncurry (+)) $
             takeWhile ((> 0) . fst) $ map (divMod (x ^ 2)) a011557_list

Formula

a(n) = sqrt(A102766(n)).

A350870 Numbers k = x.y such that x.y = (x+y)^2, when x and y have the same number of digits, "." means concatenation, and y may not begin with 0.

Original entry on oeis.org

81, 2025, 3025, 494209, 24502500, 25502500, 52881984, 60481729, 6049417284, 6832014336, 101558217124, 108878221089, 123448227904, 127194229449, 152344237969, 213018248521, 217930248900, 249500250000, 250500250000, 284270248900, 289940248521, 371718237969, 413908229449, 420744227904
Offset: 1

Views

Author

Bernard Schott, Jan 20 2022

Keywords

Comments

Problem proposed on French site Diophante (see link).
We have to solve Diophantine equation (x+y)^2 = x*10^m + y where m = length(x) = length(y).
Squares of a variant of Kaprekar numbers (A045913).
Number of solutions with 2*m digits for m >= 1: 1, 2, 1, 4, 2, 21, ...
Compare with A347541 where x*y divides x.y, when x and y have the same number of digits, "." means concatenation, and y may not begin with 0.

Examples

			81 = (8+1)^2, hence 81 is a term.
3025 = (30+25)^2, hence 3025 is another term.
		

Crossrefs

Equals A238237 \ A350918.
Subsequence of A102766.
Subsequences: A038544, A350869.

Programs

  • PARI
    upto(n) = {i = 4; i2 = i^2; res = List(); while(i2 <= n, i++; i2 = i^2; if(#digits(i2) % 2 == 1, i = sqrtint(10^(#digits(i2))) + 1; i2 = i^2; ); if(is(i2), listput(res, i2) ); ); res }
    is(n) = { my(d = digits(n), d1, d2, frd2); if(#d % 2 == 1, return(0)); d1 = vector(#d \ 2, i, d[i]); d2 = vector(#d \ 2, i, d[i + #d \ 2]); frd2 = fromdigits(d2); 10^(#d \ 2 - 1) <= frd2 && (fromdigits(d1) + frd2)^2 == n } \\ David A. Corneth, Jan 21 2022

Formula

a(n) = A045913(n+1)^2.

A171493 "Kaprekar quadruples": digits of X^4 taken D at a time sum to X (where D is number of digits in X.)

Original entry on oeis.org

1, 7, 45, 55, 67, 100, 433, 4950, 5050, 38212, 65068, 190576, 295075, 299035, 310024, 336700, 343333, 394615, 414558, 433566, 448228, 450550, 467236, 475497, 476191, 486486, 499500, 500500, 523513, 534898, 549550, 599743, 622414, 628408, 647362
Offset: 1

Views

Author

Robert Munafo, Dec 10 2009

Keywords

Comments

Referred to as "natural" Kaprekar numbers on Munafo webpage because a(n) and the 4 pieces of a(n)^4 must all have the same number of digits (some of which can be leading zeros). Analogous to A053816 for squares, as opposed to A006886 and A045913 which allow irregular divisions.

Examples

			7^4 = 2401 ; 2+4+0+1 = 7. 67^4 = 20151121 ; 20+15+11+21 = 67. 4950^4 = 600372506250000 ; 0600+3725+0625+0000 = 4950.
		

Crossrefs

Extensions

Added term a(1)=1, Robert Gerbicz, Jul 28 2011

A171500 "Kaprekar quintuples": digits of X^5 taken D at a time sum to X (where D is number of digits in X.)

Original entry on oeis.org

1, 10, 1000, 7776, 27100, 73440, 95120, 500499, 505791, 540539, 598697, 665335, 697598, 732347, 7607610, 37944478, 46945205, 54995500, 55216205, 56607166, 58106906, 63136413, 66595563, 68167738, 68807564, 69188525, 70667477, 72197730, 73197730, 74145807
Offset: 1

Views

Author

Robert Munafo, Dec 10 2009

Keywords

Comments

Referred to as "natural" Kaprekar numbers on Munafo webpage because a(n) and the 5 pieces of a(n)^5 must all have the same number of digits (some of which can be leading zeros). Analogous to A053816 for squares, as opposed to A006886 and A045913 which allow irregular divisions.

Examples

			7776^5 = 28430288029929701376 ; 2843+0288+0299+2970+1376 = 7776.
27100^5 = 14616603103510000000000 ; 146+16603+10351+00000+00000 = 27100.
		

Crossrefs

Extensions

More terms from Robert Gerbicz, Jul 28 2011
Showing 1-7 of 7 results.