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!)
A295609 a(n) = least prime number p such that p AND n = n (where AND denotes the binary AND operator). 5

%I #13 Nov 28 2017 11:55:41

%S 2,3,2,3,5,5,7,7,11,11,11,11,13,13,31,31,17,17,19,19,23,23,23,23,29,

%T 29,31,31,29,29,31,31,37,37,43,43,37,37,47,47,41,41,43,43,47,47,47,47,

%U 53,53,59,59,53,53,127,127,59,59,59,59,61,61,127,127,67,67

%N a(n) = least prime number p such that p AND n = n (where AND denotes the binary AND operator).

%C For any n > 0: gcd(A109613(n), A062383(n)) = 1, hence, by Dirichlet's theorem on arithmetic progressions, we have a prime number, say p, of the form A109613(n) + k * A062383(n) with k > 0; this prime number satisfies p AND n = n; also a(0) = 2, hence the sequence is well defined for any n >= 0.

%C a(n) = n iff n is prime.

%C Each prime number appears 2*k times in this sequence for some k > 0.

%H Rémy Sigrist, <a href="/A295609/b295609.txt">Table of n, a(n) for n = 0..8192</a>

%H Rémy Sigrist, <a href="/A295609/a295609.png">Scatterplot of the first 2^17 terms</a>

%F a(n) = n + A295335(n).

%F For any k > 1, a(2*k) = a(2*k+1).

%e a(42) = 42 + A295335(42) = 42 + 1 = 43.

%t Table[Block[{p = 2}, While[BitAnd[p, n] != n, p = NextPrime@ p]; p], {n, 0, 65}] (* _Michael De Vlieger_, Nov 26 2017 *)

%o (PARI) avoid(n,i) = if (i, if (n%2, 2*avoid(n\2,i), 2*avoid(n\2,i\2)+(i%2)), 0) \\ (i+1)-th number k such that k AND n = 0

%o a(n) = for (i=0, oo, my (k=avoid(n,i)); if (isprime(n+k), return (n+k)))

%Y Cf. A062383, A109613, A295335.

%K nonn,base

%O 0,1

%A _Rémy Sigrist_, Nov 24 2017

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 April 25 06:49 EDT 2024. Contains 371964 sequences. (Running on oeis4.)