OFFSET
1,1
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Implies
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