login
This site is supported by donations to The OEIS Foundation.
Logo

Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A039999 Number of permutations of digits of n which denote primes. 14
0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 2, 1, 0, 1, 2, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 2, 1, 0, 1, 1, 0, 2, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 2, 0, 2, 1, 0, 1, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 1, 0, 2, 1, 0, 0, 2, 0, 3, 2, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,13

COMMENTS

Consider all k! permutations of digits of a k-digit number n, discard initial zeros, count distinct primes.

LINKS

T. D. Noe, Table of n, a(n) for n=1..10000

C. Hilliard, PARI program.

EXAMPLE

a(20)=1, since from {02, 20} we get {2,20} and only 2 is prime. From 107 we get 4 primes: (0)17, (0)71, 107 and 701; so a(107) = 4.

MATHEMATICA

Table[Count[FromDigits/@Permutations[IntegerDigits[n]], _?PrimeQ], {n, 110}] (* From Harvey P. Dale, June 26 2011 *)

PROG

(PARI) for(x=1, 400, print1(permprime(x), ", ")) /* for definition of function permprime cf. link */ [From Cino Hilliard (hillcino368(AT)hotmail.com), Jun 07 2009]

(MAGMA) [ #[ s: s in Seqset([ Seqint([m(p[i]):i in [1..#x] ], 10): p in Permutations(Seqset(x)) ]) | IsPrime(s) ] where m is map< x->y | [<x[i], y[i]>:i in [1..#x] ] > where x is [1..#y] where y is Intseq(n, 10): n in [1..120] ]; [From Klaus Brockhaus, Jun 15 2009]

(Haskell)

import Data.List (permutations, nub)

a039999 n = length $ filter ((== 1) . a010051)

                   (map read (nub $ permutations $ show n) :: [Integer])

-- Reinhard Zumkeller, Feb 07 2011

CROSSREFS

Cf. A046810.

Sequence in context: A170958 A178651 A046810 * A069842 A083056 A061896

Adjacent sequences:  A039996 A039997 A039998 * A040000 A040001 A040002

KEYWORD

nonn,base,nice,easy

AUTHOR

David W. Wilson

EXTENSIONS

Contribution of C. Hilliard edited by Klaus Brockhaus, Jun 15 2009

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Transforms | Puzzles | Hot | Classics
Recent Additions | More pages | Superseeker | Maintained by The OEIS Foundation Inc.

Content is available under The OEIS End-User License Agreement .

Last modified June 19 12:29 EDT 2013. Contains 226404 sequences.