login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A323746 a(n) is the smallest positive number that is as far as possible from the nearest multiple of each of the first n primes. 1
1, 1, 7, 17, 17, 137, 9223, 69283, 1791367, 8687893, 64720793, 918317263, 39330021517, 2831766522007, 3546808269427, 40217476619183, 56941594761107557, 1248402398171502073, 6934202069468068973, 884110435325700470387, 92195422498751163402233 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,3

COMMENTS

In other words, a(n) is the smallest positive number that differs from the nearest multiple of prime(k) by at least floor(prime(k)/2) for each k in 1..n.

LINKS

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

David A. Corneth, PARI program

EXAMPLE

a(1)=1 because prime(1)=2, the nearest multiples of 2 to 1 are 0 and 2, and each differs from 1 by floor(2/2) = 1.

a(2)=1 as well because 1 satisfies not only the requirement regarding the distance from the nearest multiple of prime(1)=2 but also the additional requirement regarding the distance from the nearest multiple of prime(2)=3: the nearest multiple of 3 to 1 is 0, and |0-1| = 1 = floor(3/2) = 1.

a(3)=7 because prime(3)=5 and neither of the numbers smaller than 7 that differ from their respective nearest multiples of 5 by floor(5/2) = floor(5/2) = 2, namely, 2 and 3, also differ by 1 from their nearest multiples of 2 and 3.

The table below illustrates the first four terms. (In the table, 2*floor(k/2) is arbitrarily listed as the "nearest multiple" of 2 for each value of k; choosing 2*ceiling(k/2) would give the same resulting terms.)

.

     |     nearest    |  abs. diff. from   |

     |   multiple of  | nearest multiple of|

   k |  2   3   5   7 |  2    3    5    7  |   terms

  ---+----------------+--------------------+------------

   1 |  0   0   0   0 | *1*--*1*   1    1  | a(1), a(2)

   2 |  2   3   0   0 |  0   *1*  *2*   2  |

   3 |  2   3   5   0 | *1*   0   *2*  *3* |

   4 |  4   3   5   7 |  0   *1*   1   *3* |

   5 |  4   6   5   7 | *1*  *1*   0    2  |

   6 |  6   6   5   7 |  0    0    1    1  |

   7 |  6   6   5   7 | *1*--*1*--*2*   0  |    a(3)

   8 |  8   9  10   7 |  0   *1*  *2*   1  |

   9 |  8   9  10   7 | *1*   0    1    2  |

  10 | 10   9  10   7 |  0   *1*   0   *3* |

  11 | 10  12  10  14 | *1*  *1*   1   *3* |

  12 | 12  12  10  14 |  0    0   *2*   2  |

  13 | 12  12  15  14 | *1*  *1*  *2*   1  |

  14 | 14  15  15  14 |  0   *1*   1    0  |

  15 | 14  15  15  14 | *1*   0    0    1  |

  16 | 16  15  15  14 |  0   *1*   1    2  |

  17 | 16  18  15  14 | *1*--*1*--*2*--*3* |    a(4)

PROG

(Magma) N:=21; p:=2; prod:=p; R:=[1]; a:=R; for n in [2..N] do p:=NthPrime(n); RR:=[]; u1:=p div 2; u2:=u1+1; for m in [0..p-1] do o:=m*prod; for r in R do t:=o+r; u:=t mod p; if (u eq u1) or (u eq u2) then RR[#RR+1]:=t; if n eq N then a[n]:=t; break n; end if; end if; end for; end for; R:=RR; a[n]:=R[1]; prod*:=p; end for; a;

(PARI) See Corneth link \\ David A. Corneth, May 09 2019

CROSSREFS

Sequence in context: A196164 A071615 A067459 * A101240 A191070 A167797

Adjacent sequences:  A323743 A323744 A323745 * A323747 A323748 A323749

KEYWORD

nonn

AUTHOR

Jon E. Schoenfield, May 08 2019

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 October 18 08:00 EDT 2019. Contains 328146 sequences. (Running on oeis4.)