cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A265885 a(n) = n IMPL prime(n), where IMPL is the bitwise logical implication.

Original entry on oeis.org

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

Views

Author

Reinhard Zumkeller, Dec 17 2015

Keywords

Examples

			.   prime(25)=97 | 1100001
.             25 |   11001
.   -------------+--------
.     25 IMPL 97 | 1100111 -> a(25) = 103 .
		

Crossrefs

Programs

  • 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
    
  • 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 *)
  • PARI
    a(n) = bitor((2<Michel Marcus, Jan 22 2022

Formula

a(n) = A265705(A000040(n),n).