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.

A282687 a(n) = strictly increasing 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, 157, 300, 1839, 1922, 3099, 3240, 4189, 5544, 5967, 6506, 10815, 11760, 12871, 30612, 33267, 35002, 36411, 81486, 86653, 95676, 103263, 106060, 153219, 181332, 189097, 190440, 288615, 294596, 326403, 399318, 507253, 515004, 570291, 642320
Offset: 1

Views

Author

Daniel Suteu, Feb 20 2017

Keywords

Examples

			For n = 5, a(5) = 144, because the next prime after 144 is 149 and the previous prime before 144 is 139, where both have an equal distance of 5 from 144.
		

Crossrefs

Programs

  • Mathematica
    a = {}; Do[If[n == 1, k = 1, k = Max@ a + 1]; While[Nand[k - n == NextPrime[k, -1], k + n == NextPrime@ k], k++]; AppendTo[a, k], {n, 41}]; a (* Michael De Vlieger, Feb 20 2017 *)
  • Perl
    use ntheory qw(:all);
    for (my ($n, $k) = (1, 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);
        }
    }