login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A089704 Primes in which the unit place digit is 1 and the k-th most significant digit is prime (2,3,5,7) if k is prime else is composite (4,6,8,9,0). 3

%I #14 Jan 17 2021 16:43:28

%S 31,71,251,271,331,521,571,751,4231,4271,4721,4751,6221,6271,6521,

%T 6551,6571,8221,8231,8521,8731,9221,9371,9521,9551,9721,20231,20521,

%U 20551,20731,20771,24251,24371,24551,24571,26251,26321,26371,26731,28351

%N Primes in which the unit place digit is 1 and the k-th most significant digit is prime (2,3,5,7) if k is prime else is composite (4,6,8,9,0).

%H Harvey P. Dale, <a href="/A089704/b089704.txt">Table of n, a(n) for n = 0..1000</a>

%e 6271 is a member as unit place digit is 1, second MSD is prime, third MSD is prime and the fourth MSD is composite.

%p with(combinat, cartprod): ds:=proc(s) local j,l: l:=nops(s): RETURN(add(s[j]*10^(l-j),j=1..l)):end: p:=[2,3,5,7]:c:=[0,4,6,8,9]: ctpr:=proc(n,s) local m,T,a: a:=s: m:=1: T:=cartprod([seq(piecewise(isprime(n-i+2),p,c),i=2..n),[1]]): while not T[finished] do m:=ds(T[nextvalue]()): if isprime(m) and not member(m,a) then a:=[op(a),m] fi od: RETURN(a): end: a:=[]: for n from 1 to 5 do a:=ctpr(n,a) od: op(a); # C. Ronaldo

%t rdQ[n_]:=Module[{ridn=Reverse[IntegerDigits[n]]},Total[Which[#[[1]]==#[[2]] == 1,1,AllTrue[#,PrimeQ],1,AllTrue[#,CompositeQ],1,CompositeQ[#[[2]]] && #[[1]] == 0,1,True,0]&/@Table[{ridn[[k]],k},{k,Length[ ridn]}]] == Length[ ridn]]; Select[Prime[Range[3100]],rdQ] (* _Harvey P. Dale_, Jan 17 2021 *)

%Y Cf. A089705.

%K base,nonn

%O 0,1

%A _Amarnath Murthy_, Nov 10 2003

%E More terms from C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 25 2004

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 18 11:16 EDT 2024. Contains 375265 sequences. (Running on oeis4.)