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.
%I A019566 #31 Apr 28 2025 04:49:04 %S A019566 0,9,198,3087,41976,530865,6419754,75308643,864197532,-1358024589, %T A019566 -123580236690,-2345801446791,775432077543108,178553219976533007, %U A019566 27956332009875522906,3805734210999774512805,481583522109989673502704,58259362312008979572492603 %N A019566 The differences 1-1, 21-12, 321-123, ..., 10987654321-12345678910, 1110987654321-1234567891011, etc. %C A019566 All terms are divisible by 9, cf. A083449. There is an increasingly longer subsequence of negative terms starting at each power of 10, namely for indices n = 10..12, 100..123, 1000..1234, etc. - _M. F. Hasler_, Nov 02 2016 %C A019566 Gupta (1988) calls these "unique numbers". %D A019566 S. S. Gupta, Unique Numbers, Science Today, Jan 01 1988, India. %H A019566 Alois P. Heinz, <a href="/A019566/b019566.txt">Table of n, a(n) for n = 1..350</a> %H A019566 Shyam Sunder Gupta, <a href="http://www.shyamsundergupta.com/unique.htm">Unique Numbers</a> %H A019566 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. See Section 9.4. %F A019566 a(n) = A000422(n) - A007908(n) = 9*A083449(n). %p A019566 u:= proc(n) u(n):= `if`(n=1, 1, parse(cat(u(n-1), n))) end: %p A019566 d:= proc(n) d(n):= `if`(n=1, 1, parse(cat(n, d(n-1)))) end: %p A019566 a:= n-> d(n)-u(n): %p A019566 seq(a(n), n=1..20); # _Alois P. Heinz_, Dec 06 2014 %t A019566 f[n_] := Block[ {a = "", k = 1}, While[k < n + 1, a = StringJoin[ ToString[k], a]; k++ ]; Return[ ToExpression[a] - ToExpression[ StringReverse[a]]]]; Table[ f[n], {n, 1, 17} ] %o A019566 (PARI) A = vector(25); c = 1; f = 1; for (i = 2, 9, c = 10*c + i; f = f + i*10^(i - 1); A[i] = (f - c)); for (i = 10, 25, c = 100*c + i; f = f + i*10^(2*i - 11);; A[i] = (f - c)); A \\ _David Wasserman_, Nov 09 2004 %o A019566 (PARI) apply( {A019566(n)=A000422(n)-A007908(n)}, [1..22]) \\ Replacing code from Jan 13 2013, following a comment from Nov 02 2016. - _M. F. Hasler_, Nov 07 2020 %Y A019566 Cf. A000422, A007908. %K A019566 sign,base,easy %O A019566 1,2 %A A019566 _Robert Dickau_ %E A019566 More terms from _Robert G. Wilson v_, Jan 11 2002 %E A019566 More terms from _David Wasserman_, Nov 09 2004 %E A019566 Edited by _N. J. A. Sloane_, Nov 22 2020