Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Numbers that yield a prime whenever a '3' is inserted between any two digits.
2

%I #34 Nov 06 2022 10:18:51

%S 0,1,2,3,4,5,6,7,8,9,11,17,19,23,29,31,37,41,43,49,61,73,79,89,97,101,

%T 103,121,127,167,173,181,209,211,233,239,247,251,271,283,299,307,331,

%U 343,359,361,373,391,437,439,473,491,497,509,523,533,547,551,599

%N Numbers that yield a prime whenever a '3' is inserted between any two digits.

%C Motivated by existing sequences defined in a similar way for other digits (e.g., A164329 for digit 0), subsequence A158594 = intersection of this and A068674 ('3' is prefixed or appended), and others: cf. cross-references.

%H Chai Wah Wu, <a href="/A304248/b304248.txt">Table of n, a(n) for n = 1..10000</a>

%e 121 is in the sequence because it yields a prime when a digit 3 is inserted after the first or after the second digit, which yields the prime 1321 or 1231, respectively. The term itself does not need to be prime.

%e The single-digit numbers 0..9 are in the sequence because they satisfy the condition voidly: nothing can be inserted, so no insertion yields a nonprime, so all possible insertions always yield a prime.

%t Select[Range[0,600],AllTrue[FromDigits/@Table[Insert[IntegerDigits[#],3,n],{n,2,IntegerLength[ #]}],PrimeQ]&] (* _Harvey P. Dale_, Nov 06 2022 *)

%o (PARI) is(n, p=3, L=logint(n+!n, 10)+1, d, P)=!for(k=1, L-1, isprime((d=divrem(n, P=10^(L-k)))[2]+(10*d[1]+p)*P)||return)

%o (Magma) [0] cat [k:k in [1..600]| forall{i:i in [1..#Intseq(k)-1]| IsPrime(Seqint(Reverse(v[1..i] cat [3] cat v[i+1..#v]))) where v is Reverse(Intseq(k))}]; // _Marius A. Burtea_, Feb 09 2020

%Y Cf. A164329 (prime when 0 is inserted anywhere), A216169 (subset of composite terms), A215417 (subset of primes), A159236 (prime when 0 is inserted between all digits).

%Y Cf. A068679 (1 is prefixed, appended or inserted anywhere), A069246 (primes among these), A068673 (1 is prefixed, or appended), A304246 (1 is inserted anywhere).

%Y Cf. A304247 (2 is inserted anywhere).

%Y Cf. A158594 (3 is prefixed, appended or inserted anywhere), A215419 (primes among these), A068674 (3 is prefixed or appended).

%Y Cf. A069832 (7 is prefixed, appended or inserted anywhere), A215420 (primes among these), A068677 (7 is prefixed or appended).

%Y Cf. A069833 (9 is prefixed, appended or inserted anywhere), A215421 (primes among these).

%Y Cf. A158232 (13 is prefixed or appended).

%Y Cf. A304243 (2 is prefixed or prime(k+2) is inserted after the k-th digit), A304244 (prime(k) is inserted after the k-th digit), A304245 (prime(k+1) is inserted after the k-th digit, k > 1, or '2' after the first digit).

%K nonn,base

%O 1,3

%A _M. F. Hasler_, Jun 01 2018