A160342 Smallest near-repdigit prime with digit n occurring n times, or 0 if no such prime exists.
199, 223, 2333, 44449, 555557, 0, 77767777, 888888883, 9199999999
Offset: 1
Extensions
Corrected by Arkadiusz Wesolowski, Sep 23 2011
This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
127 is not in the sequence since 271 is prime but neither 217 nor 721 are; to be in the sequence all of these numbers would have to be prime, and they would form an orbit of size 4 (by Name, permutations of these numbers ending in 2 are not considered). 241 and 421 are in the sequence and form an orbit of size 2 since these primes can be obtained by permutations that forbid the units digit to be an even number. 569 and 659 are in the sequence since these primes can be obtained by permutations that forbid the units digit to be either 5 or an even number.
filter:= proc(n) local L,m,i,t; if not isprime(n) then return false fi; L:= convert(n,base,10); m:=nops(L); for i in select(t -> member(L[t],[1,3,7,9]), [$1..m]) do for t in combinat:-permute(subsop(i=NULL, L)) do if not isprime(L[i]+add(10^j*t[j],j=1..m-1)) then return false fi od od; true end proc: select(filter, [2,seq(i,i=3..2000,2)]); # Robert Israel, Aug 31 2018
Select[Prime@Range[120], AllTrue[FromDigits /@ Permutations[IntegerDigits@ #], PrimeQ[#] || MemberQ[{0, 2, 4, 5, 6, 8}, Mod[#, 10]] &] &] (* Giovanni Resta, Jul 14 2018 *)
Near-repdigits with three 3s are 9333, 8333, 7333, 6333, ... 3933, 3833, etc. The largest of these, 9333, is obviously divisible by 3. Not as obviously, 8333 is divisible by 13 and 641. Then we see that 7333 is prime, therefore a(3) = 7333.
Comments