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

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A270311 Indices of primes ending with the same decimal digit as the previous or next prime. 1
34, 35, 42, 43, 53, 54, 61, 62, 68, 69, 80, 81, 82, 83, 101, 102, 106, 107, 115, 116, 125, 126, 127, 128, 138, 139, 141, 142, 145, 146, 154, 155, 157, 158, 172, 173, 175, 176, 177, 178, 191, 192, 193, 194, 204, 205, 222, 223, 233, 234, 258, 259, 260, 266, 267, 269, 270, 279, 280, 289, 290, 306, 307 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

LINKS

Table of n, a(n) for n=1..63.

MATHEMATICA

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

PROG

(Javascript)

function computeBuddyPrimesIndex(max)

{

    const list = []

    var prev_digit = 0

    var curr_digit = 0

    var curr_index = 0

    var first_friend = true

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

    {

        if (!isPrime(n)) continue;

        curr_index++;

        curr_digit = n % 10

        if (curr_digit === prev_digit){

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

            if (first_friend) {

                list.push(curr_index-1)

                first_friend = false

            }

            // add current prime

            list.push(curr_index)

        }else{

            prev_digit = curr_digit

            first_friend = true

        }

   }

    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

}

CROSSREFS

Cf. A270310.

Sequence in context: A271984 A254756 A203462 * A257315 A045561 A294282

Adjacent sequences:  A270308 A270309 A270310 * A270312 A270313 A270314

KEYWORD

nonn,base

AUTHOR

Francois Alcover, Mar 15 2016

EXTENSIONS

More terms from Michael De Vlieger, 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 November 11 15:36 EST 2019. Contains 329016 sequences. (Running on oeis4.)