login
Prime vampire numbers: semiprimes x*y such that x and y have the same number of digits and the union of the multisets of the digits of x and y is the same as the multiset of digits of x*y.
1

%I #33 Nov 05 2019 05:56:04

%S 117067,124483,146137,371893,536539,10349527,10429753,10687513,

%T 11722657,11823997,12451927,12484057,12894547,13042849,14145799,

%U 14823463,17204359,18517351,18524749,18647023,19262587,19544341,19554277,20540911,20701957,21874387,30189721

%N Prime vampire numbers: semiprimes x*y such that x and y have the same number of digits and the union of the multisets of the digits of x and y is the same as the multiset of digits of x*y.

%C Subsequence of A014575.

%H Giovanni Resta, <a href="/A289911/b289911.txt">Table of n, a(n) for n = 1..10000</a>

%H Carlos Rivera, <a href="http://www.primepuzzles.net/puzzles/puzz_199.htm">Puzzle 199. The Prime-Vampire numbers</a>, The Prime Puzzles & Problems Connection.

%H G. Villemin's Almanach of Numbers, <a href="http://villemin.gerard.free.fr/Wwwgvmm/Formes/Vampire.htm">Nombres Vampires</a>, gives the first 5 terms.

%H Wikipedia, <a href="http://en.wikipedia.org/wiki/Vampire_number">Vampire number</a>.

%e 117067 = 167 * 701. A055642(117067) mod 2 = 0, A055642(167) = A055642(701) and the multiset of digits of 117067 is {0, 1, 1, 6, 7, 7}, which is also the multiset resulting from the union of the multisets of digits of 167 and 701, so 117067 is a term of the sequence.

%o (PARI) is_a001637(n) = #Str(n)%2==0

%o is_a001358(n) = omega(n)==2

%o samefactorlength(v) = #Str(v[1])==#Str(v[2])

%o samedigitmultiset(v) = vecsort(concat(digits(v[1]), digits(v[2])))==vecsort(digits(v[1]*v[2]))

%o is(n) = if(!is_a001637(n) || !is_a001358(n) || (!issquarefree(n) && bigomega(n) > 2), return(0), my(f=factor(n)[, 1]~); if(samefactorlength(f) && samedigitmultiset(f), return(1), return(0)))

%o (PARI) \\ terms with n digits (if n is odd then returns terms with n + 1 digits).

%o ndigits(n) = {n-=2; n+=(n%2); my(res=List()); forprime(p=ceil(10^(n/2)), 10^(n/2+1)-1, forprime(q = max(p, ceil(10^(n+1)/p)), 10^(n/2+1)-1, if(Set(vecsort(digits(p*q)) -vecsort(concat(digits(p),digits(q))))==[0], listput(res, p*q)))); listsort(res); res} \\ _David A. Corneth_, Jul 24 2017

%Y Cf. A001358, A001637, A014575, A055642.

%K nonn,base

%O 1,1

%A _Felix Fröhlich_, Jul 15 2017