login
Smallest absolute value of a remainder when the larger of n and its reverse is divided by the smaller.
1

%I #16 Jul 02 2018 01:37:13

%S 0,0,0,0,0,0,0,0,0,0,0,0,3,5,1,6,3,3,9,4,0,3,0,9,6,2,10,9,2,5,0,5,9,0,

%T 9,17,9,1,7,15,0,1,6,9,0,9,18,20,12,4,0,6,2,17,9,0,9,18,27,23,0,3,10,

%U 9,18,9,0,9,18,27,0,3,9,1,20,18,9,0,9,18,0,9,2,7,12,27,18,9,0,9,0,4,5,15

%N Smallest absolute value of a remainder when the larger of n and its reverse is divided by the smaller.

%H Harry J. Smith, <a href="/A061649/b061649.txt">Table of n, a(n) for n = 0..1000</a>

%e a(12)=3 since 21/12 = 2 with remainder -3.

%t lnrs[n_]:=Module[{a,b,m},{a,b}=Sort[{n,IntegerReverse[n]}];m=Mod[b,a];Min[ m,a-m]]; Join[{0},Array[lnrs,100]] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Oct 10 2017 *)

%o (PARI) { for (n=0, 1000, x=n; r=0; while (x>0, d=x-10*(x\10); x\=10; r=r*10 + d); m=min(n, r); a=max(n, r)%m; write("b061649.txt", n, " ", min(a, m-a)) ) } \\ _Harry J. Smith_, Jul 25 2009

%Y Cf. A068637 (Max(n, R(n))).

%K base,easy,nice,nonn

%O 0,13

%A _Erich Friedman_, Jun 16 2001