login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A317231 Least nonnegative difference between two numbers whose digits are all taken from a cumulative list of n mod 10 (see example). 1
0, 1, 8, 7, 59, 47, 369, 247, 1469, 247, 1469, 147, 13569, 17, 135689, 2, 1355780, 1, 12446689, 0, 12446689, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

No prepended 0 admitted.

If we start from 1 the sequence is 1, 1, 9, 7, 69, 47, 469, 247, 2469, 247, 2469, 47, ...

LINKS

Table of n, a(n) for n=0..21.

_Robert Israel_, List of the first 51 terms in even positions

FORMULA

a(2*k+1) >= a(2*k+1+20*j), with k and j >= 0;

a(20*k+19) = 0, with k >= 0.

EXAMPLE

[0] -> a(0) = 0.

[0,1] -> a(1) = 1 - 0 = 1.

[0,1,2] -> a(2) = 10 - 2 = 8.

[0,1,2,3] -> a(3) = 20 - 13 = 7.

[0,1,2,3,4] -> a(4) = 102 - 43 = 59.

[0,1,2,3,4,5] -> a(5) = 301 - 254 = 47.

[0,1,2,3,4,5,6] -> a(6) = 1023 - 654 = 369.

[0,1,2,3,4,5,6,7] -> a(7) = 4012 - 3765 = 247.

[0,1,2,3,4,5,6,7,8] -> a(8) = 10234 - 8765 = 1469.

[0,1,2,3,4,5,6,7,8,9] -> a(9) = 50123 - 49876 = 247.

[0,1,2,3,4,5,6,7,8,9,0] -> a(10) = 100234 - 98765 = 1469.

[0,1,2,3,4,5,6,7,8,9,0,1] -> a(11) = 150023 - 149876 = 147.

[0,1,2,3,4,5,6,7,8,9,0,1,2] -> a(12) = 1001223 - 987654 = 13569.

a(20) = 12446689 = 10001223344 - 9988776655. - David A. Corneth, Jul 26 2018

MAPLE

with(numtheory): with(combinat): P:=proc(q)

local a, b, c, d, f, i, j, m, n, p, k, s, x, y, w, z;

a:=[0, 1]; print(0); print(1); for n from 2 to q do b:=10^20;

a:=[op(a), n mod 10]; c:=ceil(nops(a)/2); d:=choose(a, c);

for k from 1 to nops(d) do x:=permute(d[k]);

for j from 1 to nops(x) do f:=a; for m from 1 to nops(x[j]) do

for p from 1 to nops(f) do if f[p]=x[j][m] then

f:=subsop(p=NULL, f); break; fi; od; od; y:=0;

for i from 1 to c do y:=10*y+x[j][i]; od; z:=permute(f);

for i from 1 to nops(z) do w:=0; for s from 1 to nops(z[i]) do

w:=10*w+z[i][s]; od;

if y-w>0 and ilog10(y)+1=c and ilog10(w)+1=nops(a)-c and y-w<b then b:=y-w; fi; od; od; od; print(b); od; end: P(10);

CROSSREFS

Sequence in context: A090099 A138809 A286460 * A237646 A288188 A038285

Adjacent sequences:  A317228 A317229 A317230 * A317232 A317233 A317234

KEYWORD

nonn,base,more

AUTHOR

Paolo P. Lava, Jul 24 2018

EXTENSIONS

a(13)-a(15) from Giovanni Resta, Jul 25 2018

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 4 02:14 EST 2021. Contains 341773 sequences. (Running on oeis4.)