login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A208241 Smallest prime greater than n, with n as prefix in binary representation. 5

%I

%S 2,5,7,17,11,13,29,17,19,41,23,97,53,29,31,67,71,37,79,41,43,89,47,97,

%T 101,53,109,113,59,61,127,131,67,137,71,73,149,307,79,163,83,337,173,

%U 89,181,373,191,97,197,101,103,211,107,109,223,113,229,233,239

%N Smallest prime greater than n, with n as prefix in binary representation.

%C A208238(n) <= a(n);

%C A174332(n) = a(A000040(n)).

%H Reinhard Zumkeller, <a href="/A208241/b208241.txt">Table of n, a(n) for n = 1..10000</a>

%p A208241 := proc(n)

%p local nbin,len,suf,sufbin,pbin,p ;

%p nbin := convert(n,base,2) ;

%p for len from 1 do

%p for suf from 0 to 2^len-1 do

%p sufbin := convert(suf,base,2) ;

%p while nops(sufbin) < len do

%p sufbin := [op(sufbin),0] ;

%p end do:

%p pbin := [op(sufbin),op(nbin)] ;

%p p := add( 2^(i-1)*op(i,pbin),i=1..nops(pbin) ) ;

%p if isprime(p) then

%p return p ;

%p end if;

%p end do:

%p end do:

%p end proc:

%p seq(A208241(n),n=1..50) ; # _R. J. Mathar_, May 06 2017

%o (Haskell)

%o import Data.List (genericIndex, find, isPrefixOf)

%o import Data.Maybe (fromJust)

%o a208241 = genericIndex a208241_list

%o a208241_list = f nns $ filter ((== 1) . a010051' . fst) nns where

%o f mms'@((m,ms):mms) pps'@((p,ps):pps) =

%o if m == p then f mms' pps else q : f mms pps'

%o where q = fst $ fromJust $ find ((ms `isPrefixOf`) . snd) pps'

%o nns = zip [1..] $ map reverse $ tail a030308_tabf

%Y Cf. A208238, A004676, A007088, A010051, A030308, A055011.

%K nonn,base

%O 1,1

%A _Reinhard Zumkeller_, Feb 14 2013

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 October 14 05:08 EDT 2019. Contains 327995 sequences. (Running on oeis4.)