(39gs) OEIS A110743 Smallest prime beginning with n reversed

+- HP Forums (http://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (39gs) OEIS A110743 Smallest prime beginning with n reversed (/thread-9224.html)



(39gs) OEIS A110743 Smallest prime beginning with n reversed - Gerald H - 10-04-2017 08:56 AM

The prograqmme A110743 takes natural number input N from Ans & returns the Nth member of the sequence

https://oeis.org/A110743

The programme uses two sub-programmes, REVN reverses the digits of input & is available here

http://www.hpmuseum.org/forum/thread-9223.html

& PRIM tests its argument for primality & can be found here

http://www.hpmuseum.org/forum/thread-6559.html?highlight=39gs

Code:
RUN REVN:
Ans►O:
RUN PRIM:
IF  Ans
THEN
O:
ELSE
FOR D=1 TO 6;
O*10►O:
FOR R=1 TO 10^D-1 STEP 2; 
O+R►S:
RUN PRIM:
IF Ans
THEN
10^D►R:
6►D:
ELSE
IF R MOD 5==3
THEN
R+2►R:
END:
END:
NEXT:
NEXT:
S:
END: