login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A265885
a(n) = n IMPL prime(n), where IMPL is the bitwise logical implication.
3
2, 3, 5, 7, 11, 13, 25, 23, 23, 29, 31, 55, 59, 59, 63, 63, 63, 61, 111, 111, 107, 111, 123, 127, 103, 101, 103, 107, 111, 113, 127, 223, 223, 223, 221, 223, 223, 251, 255, 255, 247, 245, 255, 211, 215, 215, 211, 223, 239, 237, 237, 239, 251, 251, 457, 455
OFFSET
1,1
LINKS
Eric Weisstein's World of Mathematics, Implies
FORMULA
a(n) = A265705(A000040(n),n).
EXAMPLE
. prime(25)=97 | 1100001
. 25 | 11001
. -------------+--------
. 25 IMPL 97 | 1100111 -> a(25) = 103 .
MAPLE
a:= n-> Bits[Implies](n, ithprime(n)):
seq(a(n), n=1..56); # Alois P. Heinz, Sep 24 2021
MATHEMATICA
IMPL[n_, k_] := If[n == 0, 0, BitOr[2^Length[IntegerDigits[k, 2]]-1-n, k]];
a[n_] := n ~IMPL~ Prime[n];
Table[a[n], {n, 1, 100}] (* Jean-François Alcover, Sep 25 2021, after David A. Corneth's code in A265705 *)
PROG
(Haskell)
a265885 n = n `bimpl` a000040 n where
bimpl 0 0 = 0
bimpl p q = 2 * bimpl p' q' + if u <= v then 1 else 0
where (p', u) = divMod p 2; (q', v) = divMod q 2
(Julia)
using IntegerSequences
[Bits("IMP", n, p) for (n, p) in enumerate(Primes(1, 263))] |> println # Peter Luschny, Sep 25 2021
(PARI) a(n) = bitor((2<<logint(prime(n), 2))-1-n, prime(n)); \\ Michel Marcus, Jan 22 2022
CROSSREFS
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Dec 17 2015
STATUS
approved