login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A282690
a(n) is the smallest number m, such that m+n is the next prime and m-n is the previous prime.
4
4, 5, 26, 93, 144, 53, 120, 1839, 532, 897, 1140, 211, 2490, 2985, 4312, 5607, 1344, 9569, 30612, 19353, 16162, 15705, 81486, 16787, 31932, 19635, 35644, 82101, 44322, 43361, 34092, 89721, 162176, 134547, 173394, 31433, 404634, 212739, 188068, 542643, 265662
OFFSET
1,1
LINKS
EXAMPLE
For n = 6, a(6) = 53, because the next prime after 53 is 59 and the previous prime before 53 is 47, where both have an equal distance of 6 from 53, which is the smallest number with this property.
MATHEMATICA
Table[k = 1; While[Nand[k - n == NextPrime[k, -1], k + n == NextPrime@ k], k++]; k, {n, 41}] (* Michael De Vlieger, Feb 20 2017 *)
PROG
(Perl)
use ntheory qw(:all);
for (my $k = 1 ; ; ++$k) {
for (my $n = 1 ; ; ++$n) {
my $p = prev_prime($n) || next;
my $q = next_prime($n);
if ($n-$p == $k and $q-$n == $k) {
printf("%s %s\n", $k, $n);
last;
}
}
}
CROSSREFS
KEYWORD
nonn
AUTHOR
Daniel Suteu, Feb 20 2017
STATUS
approved