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!)
A046810 Number of anagrams of n that are primes. 18
0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 2, 1, 0, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 2, 1, 0, 1, 1, 0, 2, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 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, 1, 0, 1, 1, 0, 1, 2, 0 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,13
COMMENTS
An anagram of a k-digit number is one of the k! permutations of the digits that does not begin with 0.
LINKS
EXAMPLE
107 has 2 prime anagrams: 107 and 701 (but not 017 or 071); so a(107) = 2.
MATHEMATICA
Table[Count[FromDigits/@Select[Permutations[IntegerDigits[n]], First[#] != 0&], _?(PrimeQ[#]&)], {n, 110}] (* Harvey P. Dale, Aug 24 2011 *)
PROG
(Haskell)
import Data.List (permutations, nub)
a046810 n = length $ filter ((== 1) . a010051)
$ map read (nub $ filter ((> '0') . head)
$ permutations $ show n)
-- Reinhard Zumkeller, Aug 14 2011
(Python)
from sympy import isprime
from itertools import permutations
def a(n): return len(set(t for p in permutations(str(n)) if p[0]!="0" and isprime(t:=int("".join(p)))))
print([a(n) for n in range(1, 106)]) # Michael S. Branicky, Feb 17 2024
CROSSREFS
Sequence in context: A178665 A170958 A178651 * A328515 A356682 A323989
KEYWORD
nonn,easy,base,nice
AUTHOR
STATUS
approved

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 1 13:16 EDT 2024. Contains 374817 sequences. (Running on oeis4.)