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).

This page as a plain text file.
%I A007745 #36 Sep 08 2022 08:44:35
%S A007745 1,6,11,20,29,38,55,72,89,110,123,156,173,206,239,272,305,342,379,404,
%T A007745 445,502,535,600,633,702,731,796,861,926,991,1056,1121,1190,1259,1332,
%U A007745 1405,1446,1527,1640,1721,1774,1851,1980,2029,2158,2223,2352,2417,2550
%N A007745 a(n) = n OR n^2 (applied to binary expansions).
%H A007745 Alois P. Heinz, <a href="/A007745/b007745.txt">Table of n, a(n) for n = 1..10000</a>
%p A007745 a:= n-> Bits[Or](n, n^2):
%p A007745 seq(a(n), n=1..100);  # _Alois P. Heinz_, Mar 29 2018
%t A007745 (* program should not be used to extend this sequence *)
%t A007745 d = 15; Mb = Array[ 2^(d - #)&, d ]; Map[ Plus@@(Mb*#)&, Array[ IntegerDigits[ #, 2, d ] + IntegerDigits[ #^2, 2, d ]&, 180 ]/. (2->1) ] (* Mocquard and Bouchon *)
%t A007745 Table[BitOr[n, n^2], {n, 100}] (* _Vladimir Joseph Stephan Orlovsky_, Jul 19 2011 *)
%o A007745 (Haskell)
%o A007745 import Data.Bits ((.|.))
%o A007745 a007745 n = n .|. (n ^ 2)  -- _Reinhard Zumkeller_, Apr 28 2014
%o A007745 (PARI) a(n) = bitor(n, n^2); \\ _Michel Marcus_, Mar 30 2018
%o A007745 (Magma) [BitwiseOr(n,n^2): n in [1..50]]; // _Bruno Berselli_, Mar 30 2018
%Y A007745 Cf. A169810 (XOR), A213541 (AND), A002378.
%K A007745 base,nonn,easy
%O A007745 1,2
%A A007745 J. P. Mocquard and D. Bouchon (BOUCHON(AT)zeus.univ-poitiers.fr)