A246944 Prime numbers p with property that when the first digit is shifted to the last digit, we obtain a prime greater than p.
13, 17, 37, 79, 113, 127, 131, 149, 157, 163, 181, 191, 197, 199, 337, 359, 367, 373, 787, 797, 1117, 1123, 1129, 1151, 1153, 1181, 1187, 1193, 1201, 1213, 1231, 1237, 1259, 1279, 1297, 1301, 1319, 1327, 1367, 1409, 1423, 1427, 1439, 1459, 1483, 1487, 1493
Offset: 1
Examples
13: when 1 is shifted to last it becomes 31.
Links
- Jens Kruse Andersen, Table of n, a(n) for n = 1..10000
Crossrefs
Cf. A109308.
Programs
-
Mathematica
fdlQ[n_]:=Module[{c=FromDigits[RotateLeft[IntegerDigits[n]]]},PrimeQ[c] && c>n]; Select[Prime[Range[300]],fdlQ] (* Harvey P. Dale, Jun 06 2018 *)
-
PARI
move(n)=n=Vec(Str(n));N=List();for(i=2,#n,listput(N,n[i]));listput(N,n[1]);return(eval(concat(N))); forprime(p=2,1000,if(isprime(move(p))&&move(p)>p,print1(p,","))) \\ Edward Jiang, Sep 08 2014
-
PHP
function number_firsttolast($a) { $b=str_split($a); $c=count($b); for($i=1;$i<$c;$i++) { $d=$d.$b[$i]; } $e=$d.$b[0]; return ($e); }