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.

A282690 a(n) is the smallest number m, such that m+n is the next prime and m-n is the previous prime.

Original entry on oeis.org

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

Views

Author

Daniel Suteu, Feb 20 2017

Keywords

Examples

			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.
		

Crossrefs

Programs

  • 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 *)
  • 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;
            }
        }
    }