login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A007745 a(n) = n OR n^2 (applied to binary expansions). 8

%I #36 Sep 08 2022 08:44:35

%S 1,6,11,20,29,38,55,72,89,110,123,156,173,206,239,272,305,342,379,404,

%T 445,502,535,600,633,702,731,796,861,926,991,1056,1121,1190,1259,1332,

%U 1405,1446,1527,1640,1721,1774,1851,1980,2029,2158,2223,2352,2417,2550

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

%H Alois P. Heinz, <a href="/A007745/b007745.txt">Table of n, a(n) for n = 1..10000</a>

%p a:= n-> Bits[Or](n, n^2):

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Mar 29 2018

%t (* program should not be used to extend this sequence *)

%t 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 Table[BitOr[n, n^2], {n, 100}] (* _Vladimir Joseph Stephan Orlovsky_, Jul 19 2011 *)

%o (Haskell)

%o import Data.Bits ((.|.))

%o a007745 n = n .|. (n ^ 2) -- _Reinhard Zumkeller_, Apr 28 2014

%o (PARI) a(n) = bitor(n, n^2); \\ _Michel Marcus_, Mar 30 2018

%o (Magma) [BitwiseOr(n,n^2): n in [1..50]]; // _Bruno Berselli_, Mar 30 2018

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

%K base,nonn,easy

%O 1,2

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

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified July 14 13:29 EDT 2024. Contains 374318 sequences. (Running on oeis4.)