OFFSET
0,1
COMMENTS
If the two copies of the 2n+1 are not allowed to share digits, a(1) is not 3, a(2) is not 5 and a(3) is not 7 and a(5) is not 11, which results in A070278.
Conjecture: a(n) = 0 if and only if n > 2 and n == 2 mod 5 (which makes 2*n+1 == 0 mod 5). - Robert Israel, May 26 2015
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..10000
EXAMPLE
a(6060) = 1212121, because it is the smallest prime beginning and ending in 2*6060+1 = 12121.
a(7+5*k) = 0, because 2*(7+5*k)+1 = 15+10*k == 0 (mod 5) is no prime.
MAPLE
A071234 := proc(n)
local dgsn , p, wrks, doff;
dgsn := convert(2*n+1, base, 10) ;
for i from 1 to 1000000 do
p := ithprime(i) ;
wrks := true;
dgsp := convert(p, base, 10) ;
doff := nops(dgsp)-nops(dgsn) ;
if doff >= 0 then
for d from 1 to nops(dgsn) do
if op(d, dgsp) <> op(d, dgsn) then
wrks := false;
break;
end if;
if op(d+doff, dgsp) <> op(d, dgsn) then
wrks := false;
break;
end if;
end do:
if wrks then
return p
end if;
end if;
end do:
return 0 ;
end proc: # R. J. Mathar, Feb 03 2011
# Alternative:
f:= proc(n)
local u, d, r, x, y;
u:= 2*n+1;
if isprime(u) then return(u) fi;
if u mod 5 = 0 then return(0) fi;
d:= ilog10(u);
for r from 0 do
for x from 0 to 10^(r+1)-1 do
y:= u + 10^(d+1)*x + 10^(r+d+2)*u;
if isprime(y) then return(y) fi
od od
end proc:
11, seq(f(n), n=1..100); # Robert Israel, May 26 2015
PROG
(Sage)
def A071234(n):
s = str(2*n+1)
if s.endswith('5') and not s == '5': return 0
for p in Primes():
ps = str(p)
if ps.startswith(s) and ps.endswith(s): return p
[A071234(n) for n in range(20)]
# D. S. McNeil, Feb 03 2011
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Amarnath Murthy, May 18 2002
STATUS
approved