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

 

Logo

Thanks to everyone who made a donation during our annual appeal!
To see the list of donors, or make a donation, see the OEIS Foundation home page.

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A254606 The minimum absolute difference between k*p1 and p2 (p1<p2), where p1*p2 is the n-th term of A087112. 3
0, 1, 0, 1, 1, 0, 1, 1, 2, 0, 1, 1, 1, 3, 0, 1, 1, 2, 1, 2, 0, 1, 1, 2, 3, 5, 4, 0, 1, 1, 1, 2, 3, 6, 2, 0, 1, 1, 2, 2, 1, 3, 6, 4, 0, 1, 1, 1, 1, 4, 3, 5, 9, 6, 0, 1, 1, 1, 3, 2, 5, 3, 7, 8, 2, 0, 1, 1, 2, 2, 4, 2, 3, 1, 9, 8, 6, 0, 1, 1, 1, 1, 3, 2, 7, 3, 5 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,9

COMMENTS

k is an integer that minimizes |k*p1-p2|. It is trivial that if j is the integer part of p2/p1, k is either j or j+1.

LINKS

Lei Zhou, Table of n, a(n) for n = 1..10000

EXAMPLE

A087112(1)=4=2*2, 2-2=0, so a(1)=0;

A087112(2)=6=2*3, 3-2=2*2-3=1, so a(2)=1;

...

A087112(9)=35=5*7, 7-5=2, and 2*5-7=3, the smaller is 2. So a(9)=2.

MATHEMATICA

NumDiff[n1_, n2_] :=  Module[{c1 = n1, c2 = n2}, If[c1 < c2, c1 = c1 + c2; c2 = c1 - c2; c1 = c1 - c2]; k = Floor[c1/c2]; a1 = c1 - k*c2; If[a1 == 0, a2 = 0, a2 = (k + 1) c2 - c1]; Return[Min[a1, a2]]];

p1 = 2; p2 = 1; Table[p2 = NextPrime[p2]; If[p2 > p1, p1 = p2; p2 = 2]; NumDiff[p1, p2], {n, 1, 100}]

CROSSREFS

Cf. A087112, A254605.

Sequence in context: A144092 A120648 A215401 * A175358 A235330 A029394

Adjacent sequences:  A254603 A254604 A254605 * A254607 A254608 A254609

KEYWORD

nonn,easy

AUTHOR

Lei Zhou, Feb 02 2015

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 January 22 07:30 EST 2020. Contains 331139 sequences. (Running on oeis4.)