login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

n is prime and remains prime when its leading digit is replaced by each of 2, 4 and 8.
1

%I #12 Jun 04 2017 13:30:09

%S 13,23,43,53,73,83,139,157,163,239,257,263,439,457,463,557,563,739,

%T 757,839,857,863,1297,1423,1447,1663,1861,1999,2111,2243,2273,2297,

%U 2423,2447,2663,2861,2969,2999,4111,4243,4273,4297,4423,4447,4663,4861,4969

%N n is prime and remains prime when its leading digit is replaced by each of 2, 4 and 8.

%C 2, 4 and 8 were chosen because they are powers of 2.

%H Harvey P. Dale, <a href="/A067227/b067227.txt">Table of n, a(n) for n = 1..1000</a>

%e 53 is prime and so are 23, 43, 83, so 53 is a term of the sequence.

%t (*replaces the leading digit of n by m*) f[n_, m_] := FromDigits[Flatten[Append[IntegerDigits[m], Drop[IntegerDigits[n], 1]]]]; Select[Range[10^4], PrimeQ[ # ] && PrimeQ[f[ #, 2]] && PrimeQ[f[ #, 4]] && PrimeQ[f[ #, 8]] & ]

%t Select[Prime[Range[700]],AllTrue[FromDigits/@Table[Join[{i},Rest[ IntegerDigits[ #]]],{i,{2,4,8}}],PrimeQ]&] (* The program uses the AllTrue function from Mathematica version 10 *) (* _Harvey P. Dale_, Jun 04 2017 *)

%K base,nonn

%O 1,1

%A _Joseph L. Pe_, Feb 20 2002

%E Offset corrected to 1 and title simplified by _M. F. Hasler_, Nov 01 2014