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.

A060982 a(n) = Smallest nontrivial number k > 9 such that |first (leftmost) decimal digit of k - second digit + third digit - fourth digit ...| = n.

This page as a plain text file.
%I A060982 #13 May 24 2022 07:57:20
%S A060982 11,10,13,14,15,16,17,18,19,90,109,209,309,409,509,609,709,809,909,
%T A060982 10909,20909,30909,40909,50909,60909,70909,80909,90909,1090909,
%U A060982 2090909,3090909,4090909,5090909,6090909,7090909,8090909,9090909,109090909,209090909,309090909
%N A060982 a(n) = Smallest nontrivial number k > 9 such that |first (leftmost) decimal digit of k - second digit + third digit - fourth digit ...| = n.
%C A060982 Starting with 109, this sequence has the same terms as A061479 and A061882. - _Georg Fischer_, May 24 2022
%H A060982 Michael S. Branicky, <a href="/A060982/b060982.txt">Table of n, a(n) for n = 0..4500</a>
%F A060982 For n > 8, if r = 0, a(n) = 90..90, else a(n) = r09..09, where r = n mod 9 and 90 and 09, resp., occur ceiling(n/9) times. - _Michael S. Branicky_, Nov 10 2021
%t A060982 m = 2; Do[ While[ a = IntegerDigits[ m ]; l = Length[ a ]; e = o = {}; Do[ o = Append[ o, a[ [ 2k - 1 ] ] ], {k, 1, l/2 + .5} ]; Do[ e = Append[ e, a[ [ 2k ] ] ], {k, 1, l/2} ]; Abs[ Apply[ Plus, o ] - Apply[ Plus, e ] ] != n, m++ ]; Print[ m ], {n, 1, 50} ]
%o A060982 (Python)
%o A060982 def f(m): return abs(sum((-1)**i*int(d) for i, d in enumerate(str(m))))
%o A060982 def a(n):
%o A060982     m = 10
%o A060982     while f(m) != n: m += 1
%o A060982     return m
%o A060982 print([a(n) for n in range(28)]) # _Michael S. Branicky_, Nov 10 2021
%o A060982 (Python) # faster version based on formula
%o A060982 def a(n):
%o A060982     if n < 10: return [11, 10, 13, 14, 15, 16, 17, 18, 19, 90][n]
%o A060982     q, r = divmod(n, 9)
%o A060982     return int(str(r if r else 9) + "09"*(q if r else q-1))
%o A060982 print([a(n) for n in range(40)]) # _Michael S. Branicky_, Nov 10 2021
%Y A060982 Cf. A008593, A060978-A060980, A060982, A061470-A061479, A061870-A061882.
%K A060982 base,nonn,easy
%O A060982 0,1
%A A060982 _Robert G. Wilson v_, May 10 2001
%E A060982 a(39) and beyond from _Michael S. Branicky_, Nov 10 2021
%E A060982 Definition amended by _Georg Fischer_, May 24 2022