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.

A254605 The minimum absolute difference between k*m1 and m2 (m1 where m1*m2 is the n-th term of A075362.

This page as a plain text file.
%I A254605 #14 Mar 19 2015 07:12:12
%S A254605 0,0,0,0,1,0,0,0,1,0,0,1,1,1,0,0,0,0,2,1,0,0,1,1,1,2,1,0,0,0,1,0,2,2,
%T A254605 1,0,0,1,0,1,1,3,2,1,0,0,0,1,2,0,2,3,2,1,0,0,1,1,1,1,1,3,3,2,1,0,0,0,
%U A254605 0,0,2,0,2,4,3,2,1,0,0,1,1,1,2,1,1,3,4
%N A254605 The minimum absolute difference between k*m1 and m2 (m1<m2), where m1*m2 is the n-th term of A075362.
%C A254605 k is an integer that minimizes |k*m1-m2|. It is trivial that if j is the integer part of m2/m1, k is either j or j+1.
%C A254605 Interestingly, suppose b is the smallest n such that a(n)=c; the sequence s(c)=b is then sequence A022267.
%H A254605 Lei Zhou, <a href="/A254605/b254605.txt">Table of n, a(n) for n = 1..10000</a>
%e A254605 A075362(1)=1=1*1, 1-1=0, so a(1)=0;
%e A254605 A075362(5)=6=2*3, 3-2=1, 2*2-3=1, so a(5)=1;
%e A254605 A075362(19)=24=4*6, 6-4=2, 4*2-6=2, so a(19)=2.
%t A254605 NumDiff[n1_, n2_] :=  Module[{c1 = n1, c2 = n2}, If[c1 < c2, c1 = c1 + c2; c2 = c1 - c2; c1 = c1 - c2];
%t A254605   k = Floor[c1/c2]; a1 = c1 - k*c2; If[a1 == 0, a2 = 0, a2 = (k + 1) c2 - c1]; Return[Min[a1, a2]]];
%t A254605 p1 = 1; p2 = 0; Table[p2++; If[p2 > p1, p1 = p2; p2 = 1];  NumDiff[p1, p2], {n, 1, 100}]
%Y A254605 Cf. A075362, A022267.
%K A254605 nonn,easy
%O A254605 1,19
%A A254605 _Lei Zhou_, Feb 02 2015