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.

A007745 a(n) = n OR n^2 (applied to binary expansions).

Original entry on oeis.org

1, 6, 11, 20, 29, 38, 55, 72, 89, 110, 123, 156, 173, 206, 239, 272, 305, 342, 379, 404, 445, 502, 535, 600, 633, 702, 731, 796, 861, 926, 991, 1056, 1121, 1190, 1259, 1332, 1405, 1446, 1527, 1640, 1721, 1774, 1851, 1980, 2029, 2158, 2223, 2352, 2417, 2550
Offset: 1

Views

Author

J. P. Mocquard and D. Bouchon (BOUCHON(AT)zeus.univ-poitiers.fr)

Keywords

Crossrefs

Cf. A169810 (XOR), A213541 (AND), A002378.

Programs

  • Haskell
    import Data.Bits ((.|.))
    a007745 n = n .|. (n ^ 2)  -- Reinhard Zumkeller, Apr 28 2014
    
  • Magma
    [BitwiseOr(n,n^2): n in [1..50]]; // Bruno Berselli, Mar 30 2018
  • Maple
    a:= n-> Bits[Or](n, n^2):
    seq(a(n), n=1..100);  # Alois P. Heinz, Mar 29 2018
  • Mathematica
    (* program should not be used to extend this sequence *)
    d = 15; Mb = Array[ 2^(d - #)&, d ]; Map[ Plus@@(Mb*#)&, Array[ IntegerDigits[ #, 2, d ] + IntegerDigits[ #^2, 2, d ]&, 180 ]/. (2->1) ] (* Mocquard and Bouchon *)
    Table[BitOr[n, n^2], {n, 100}] (* Vladimir Joseph Stephan Orlovsky, Jul 19 2011 *)
  • PARI
    a(n) = bitor(n, n^2); \\ Michel Marcus, Mar 30 2018