login
Smallest prime greater than n-th prime containing all of its digits in decimal representation.
1

%I #12 Jan 29 2014 07:50:11

%S 23,13,53,17,101,31,71,109,223,229,103,73,149,347,347,353,359,163,167,

%T 107,137,97,283,389,179,1013,1013,701,1009,131,271,311,173,193,419,

%U 1051,571,613,617,317,197,811,911,1039,719,919,1021,1223,2027,1229,2333

%N Smallest prime greater than n-th prime containing all of its digits in decimal representation.

%H Reinhard Zumkeller, <a href="/A199713/b199713.txt">Table of n, a(n) for n = 1..10000</a>

%e n | a(n) | prime(n)

%e -----+--------+---------

%e 1 | 23 | 2

%e 2 | 13 | 3

%e 3 | 53 | 5

%e 4 | 17 | 7

%e 5 | 101 | 11

%e 6 | 31 | 13

%e 7 | 71 | 17

%e 8 | 109 | 19

%e 9 | 223 | 23

%e 10 | 229 | 29

%e ....

%e 26 | 1013 | 101

%e 27 | 1013 | 103

%e 28 | 701 | 107

%e 29 | 1009 | 109

%e 30 | 131 | 113

%e 31 | 271 | 127

%e 32 | 311 | 131 .

%o (Haskell)

%o a199713 n = f ps where

%o f (q:qs) = if sort (show q) `contains` sort (show p) then q else f qs

%o contains _ [] = True

%o contains [] _ = False

%o contains (u:us) vs'@(v:vs) | u == v = contains us vs

%o | otherwise = contains us vs'

%o p : ps = drop (n-1) a000040_list

%Y Cf. A000040, A055387.

%K nonn,base,look

%O 1,1

%A _Reinhard Zumkeller_, Nov 09 2011