A061649 Smallest absolute value of a remainder when the larger of n and its reverse is divided by the smaller.
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, 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, 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
Offset: 0
Examples
a(12)=3 since 21/12 = 2 with remainder -3.
Links
- Harry J. Smith, Table of n, a(n) for n = 0..1000
Crossrefs
Cf. A068637 (Max(n, R(n))).
Programs
-
Mathematica
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 *)
-
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