[go: up one dir, main page]

login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A090287
Smallest prime obtained by sandwiching n between a number with identical digits, or 0 if no such prime exists. Primes of the form k n k where all the digits of k are identical.
8
101, 313, 727, 131, 11411, 151, 777767777, 373, 181, 191, 9109, 0, 7127, 331333, 991499, 1151, 3163, 1171, 1181, 9199, 1201, 112111, 0, 1231, 7247, 3253, 7777777777267777777777, 1111271111, 11128111, 1291, 1301, 3313, 1321, 0, 3343, 333533, 1361, 3373, 1381
OFFSET
0,1
COMMENTS
a(n) = 0 if n is a palindrome with even number of digits. Conjecture: No other term is zero.
The conjecture is false. a(231) = 0, a(420) = 0, a(n) = 0 if 11 divides n and n has an even number of digits. a(1414) has over 2000 digits. - Chai Wah Wu, Mar 31 2015
MATHEMATICA
(* f(n) defined by José de Jesús Camacho Medina in A010785. *)
lst={}; f[m_]:=IntegerDigits[(m-9*Floor[(m-1)/9])*(10^Floor[(m+8)/9]-1)/9];
g[n_]:=FromDigits[Flatten[{f[m], IntegerDigits[n], f[m]}]];
Do[m=1; While[True, If[Mod[Length[IntegerDigits[n]], 2]==0&&IntegerDigits[n]==Reverse[IntegerDigits[n]],
AppendTo[lst, 0]; Break[], If[PrimeQ[g[n]], AppendTo[lst, g[n]]; Break[]]]; m++], {n, 25}];
lst (* Ivan N. Ianakiev, Mar 23 2015 *)
PROG
(Python)
from gmpy2 import is_prime, mpz, digits
def A090287(n, limit=2000):
....sn = str(n)
....if n in (231, 420, 759) or not (len(sn) % 2 or n % 11):
........return 0
....for i in range(1, limit+1):
........for j in range(1, 10, 2):
............si = digits(j, 10)*i
............p = mpz(si+sn+si)
............if is_prime(p):
................return int(p)
....else:
........return 'search limit reached.' # Chai Wah Wu, Mar 31 2015
CROSSREFS
Sequence in context: A142578 A256048 A252942 * A134971 A082770 A161907
KEYWORD
base,nonn
AUTHOR
Amarnath Murthy, Nov 29 2003
EXTENSIONS
a(0) from Chai Wah Wu, Mar 23 2015
a(26)-a(38) from Chai Wah Wu, Mar 24 2015
STATUS
approved