%I #44 Jun 20 2023 18:57:39
%S 2,3,5,7,23,43,67,89,1423,2143,2341,2543,4231,4253,4523,4567,4657,
%T 5647,5867,6547,6857,10243,12043,20143,20341,20431,23041,24103,25463,
%U 25643,30241,32401,36457,40123,40213,40231,41023,41203,42013,43201,45263,45673,45763
%N Primes whose digits can be arranged as consecutive digits (more precisely, to form a substring of 0123456789).
%C These are the primes whose digits can be permuted to give a substring of 0123456789.
%C This sequence has exactly 6744 terms, none of which are 3-digit, 6-digit, 9-digit, or 10-digit numbers because these are all divisible by 3. The last term is 98745623. - _Chris K. Caldwell_
%H Nathaniel Johnston, <a href="/A177119/b177119.txt">Table of n, a(n) for n = 1..6744</a> (full sequence)
%H G. L. Honaker, Jr. and Chris Caldwell, <a href="https://t5k.org/curios/cpage/22862.html">Prime Curios! 2543</a>
%e a(12)=2543 can be arranged as 2345.
%e 109 is not a term since 019 is not a substring of 0123456789.
%p A177119:={}: for d from 1 to 5 do for s from 0 to 10-d do l:=combinat[permute]([$(s..(s+d-1))]): for k from 1 to d! do n:=add(10^(d-j)*l[k][j],j=1..d): if(isprime(n))then A177119 := A177119 union {n}: fi: od: od: od: op(A177119); # _Nathaniel Johnston_, Jun 23 2011
%t (* computes all terms *) Reap[Do[p=Prime[n]; If[p<10 || Union[Differences[Sort[IntegerDigits[p]]]] == {1}, Sow[p]], {n, PrimePi[98765432]}]][[2, 1]] (* _T. D. Noe_, Dec 10 2010 *)
%t lst = {}; Do[AppendTo[lst, Select[FromDigits /@ Permutations@Range[n, d + n - 1], PrimeQ[#] &]], {d, 5}, {n, 0, 10 - d}]; Union@Flatten[lst] (* _Arkadiusz Wesolowski_, Jan 07 2013 *)
%t Join[{2,3,5,7},Select[Prime[Range[57*10^5]],Union[Differences[Sort[IntegerDigits[#]]]]=={1}&]] (* _Harvey P. Dale_, Jun 20 2023 *)
%Y Cf. A000040, A001477, A156119. See A068710 for a different (and presumably infinite) version.
%K nonn,easy,fini,full,base
%O 1,1
%A _G. L. Honaker, Jr._, Dec 09 2010
%E Extended by _Chris K. Caldwell_
%E Edited by _N. J. A. Sloane_, Jan 22 2011