%I #14 Jul 29 2020 05:52:00
%S 4,5,26,93,144,53,120,1839,532,897,1140,211,2490,2985,4312,5607,1344,
%T 9569,30612,19353,16162,15705,81486,16787,31932,19635,35644,82101,
%U 44322,43361,34092,89721,162176,134547,173394,31433,404634,212739,188068,542643,265662
%N a(n) is the smallest number m, such that m+n is the next prime and m-n is the previous prime.
%H Daniel Suteu, <a href="/A282690/b282690.txt">Table of n, a(n) for n = 1..100</a>
%e 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.
%t Table[k = 1; While[Nand[k - n == NextPrime[k, -1], k + n == NextPrime@ k], k++]; k, {n, 41}] (* _Michael De Vlieger_, Feb 20 2017 *)
%o (Perl)
%o use ntheory qw(:all);
%o for (my $k = 1 ; ; ++$k) {
%o for (my $n = 1 ; ; ++$n) {
%o my $p = prev_prime($n) || next;
%o my $q = next_prime($n);
%o if ($n-$p == $k and $q-$n == $k) {
%o printf("%s %s\n", $k, $n);
%o last;
%o }
%o }
%o }
%Y Cf. A087378, A087711, A282687.
%K nonn
%O 1,1
%A _Daniel Suteu_, Feb 20 2017
|