login
The OEIS Foundation is supported by donations from users of the OEIS and by a grant from the Simons 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

Table of n, a(n) for n=1..63.

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

Cf. A018800, A062584, A068164.

Sequence in context: A160137 A107698 A068164 * A110743 A077549 A089356

Adjacent sequences:  A089751 A089752 A089753 * A089755 A089756 A089757

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 | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified February 27 15:16 EST 2020. Contains 332307 sequences. (Running on oeis4.)