The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A089754 Smallest prime ending (least significant side) in n if possible else beginning in n. 1
11, 2, 3, 41, 5, 61, 7, 83, 19, 101, 11, 127, 13, 149, 151, 163, 17, 181, 19, 2003, 421, 223, 23, 241, 251, 263, 127, 281, 29, 307, 31, 3203, 233, 347, 353, 367, 37, 383, 139, 401, 41, 421, 43, 443, 457, 461, 47, 487, 149, 503, 151, 521, 53, 541, 557, 563, 157, 587, 59, 601, 61, 6203, 163 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
MAPLE
read("transforms)"):
nleadzero := proc(n, dgs)
local ndgs ;
if n = 0 then
ndgs := 0 ;
else
ndgs := ilog10(n)+1 ;
end if;
[op(convert(n, base, 10)), seq(0, i=1..dgs-ndgs)]
end proc:
digcatL2 := proc(L1, L2)
digcatL([op(L1), op(L2)]) ;
end proc:
A089754 := proc(n)
local prep, a, dgs ;
if isprime(n) then
n;
elif modp(n, 2) = 0 or modp(n, 5) = 0 then
ndgs := convert(n, base, 10) ;
for dgs from 1 do
for prep from 0 to 10^dgs-1 do
a := digcatL2(ListTools[Reverse](ndgs), ListTools[Reverse](nleadzero(prep, dgs))) ;
if isprime(a) then
return a;
end if;
end do:
end do:
else
for prep from 1 do
a := digcat2(prep, n) ;
if isprime(a) then
return a;
end if;
end do:
end if;
end proc: # R. J. Mathar, Sep 18 2015
CROSSREFS
Sequence in context: A371885 A107698 A068164 * A110743 A077549 A089356
KEYWORD
base,easy,nonn
AUTHOR
Amarnath Murthy, Nov 22 2003
EXTENSIONS
Corrected by R. J. Mathar, Sep 18 2015
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 15 22:47 EDT 2024. Contains 372549 sequences. (Running on oeis4.)