OFFSET
1,1
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
(p,q,r) = (1627,1637,1657), are three primes which are consecutive and end in the same digit. Hence, p=1627 is a member of this sequence.
MAPLE
q:= 3: r:= 5: count:= 0: R:= NULL:
while count < 100 do
p:= q; q:= r; r:= nextprime(r);
if p-q mod 10 = 0 and q-r mod 10 = 0 then count:= count+1; R:= R, p; fi
od:
R; # Robert Israel, May 08 2020
MATHEMATICA
First /@ Select[Partition[Prime@ Range@ 4105, 3, 1], Length@ Union@ Mod[#, 10] == 1 &] (* Giovanni Resta, Oct 16 2019 *)
PROG
(Magma) f:=func<p, m|p mod 10 eq m and NextPrime(p) mod 10 eq m and NextPrime(NextPrime(p)) mod 10 eq m>; a:=[]; for p in PrimesUpTo(40000) do if f(p, 1) or f(p, 3) or f(p, 7) or f(p, 9) then Append(~a, p); end if; end for; a; // Marius A. Burtea, Oct 16 2019
(PARI) isok(p) = {if (isprime(p), my(d = p % 10); my(q = nextprime(p+1), r = nextprime(q+1)); (d == (q % 10)) && (d == (r % 10)); ); } \\ Michel Marcus, Oct 17 2019
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Philip Mizzi, Oct 15 2019
STATUS
approved