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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A270310 Primes ending with the same decimal digit as the previous or next prime. 4
139, 149, 181, 191, 241, 251, 283, 293, 337, 347, 409, 419, 421, 431, 547, 557, 577, 587, 631, 641, 691, 701, 709, 719, 787, 797, 811, 821, 829, 839, 887, 907, 919, 929, 1021, 1031, 1039, 1049, 1051, 1061, 1153, 1163, 1171, 1181, 1249, 1259, 1399, 1409, 1471, 1481, 1627, 1637, 1657, 1699, 1709 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

Charles R Greathouse IV, Table of n, a(n) for n = 1..10000

Robert J. Lemke Oliver and Kannan Soundararajan, Unexpected biases in the distribution of consecutive primes (2016)

FORMULA

a(n) = prime(A270311(n)).

MATHEMATICA

Select[Prime@ Range@ 300, Function[k, Or[k == Mod[NextPrime@ #, 10], k == Mod[NextPrime[#, -1], 10]]]@ Mod[#, 10] &] (* Michael De Vlieger, Mar 15 2016 *)

PROG

(Javascript)

function computeBuddyPrimes(max)

{

    const list = []

    var prev_digit = 0

    var prev_prime = 0

    var curr_digit = 0

    var first_friend = true

    for (var n=2; n<=max; n++)

    {

        if (!isPrime(n)) continue;

        curr_digit = n % 10

        if (curr_digit === prev_digit){

            // add previous prime if it was first in current group

            if (first_friend) {

                list.push(prev_prime)

                first_friend = false

            }

            // add current prime

            list.push(n)

        }else{

            prev_digit = curr_digit

            first_friend = true

        }

        prev_prime = n

    }

    return list

}

function isPrime(n)

{

    if (n<2)

        return false;

    const sqrt = Math.sqrt(n)

    var div = 2

    while (div <= sqrt) {

        if (n % div < 1)

            return false;

        div++

    }

    return true

}

(PARI) is(n)=isprime(n) && ((nextprime(n+1)-n)%10==0 || (n-precprime(n-1))%10==0) \\ Charles R Greathouse IV, Mar 15 2016

CROSSREFS

Cf. A270311.

Sequence in context: A005447 A261703 A266003 * A047652 A308788 A308796

Adjacent sequences:  A270307 A270308 A270309 * A270311 A270312 A270313

KEYWORD

base,easy,nonn

AUTHOR

Francois Alcover, Mar 15 2016

EXTENSIONS

a(15)-a(55) from Charles R Greathouse IV, Mar 15 2016

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 September 17 17:32 EDT 2019. Contains 327136 sequences. (Running on oeis4.)