Jump to content

Exponentiation operator: Difference between revisions

Line 665:
pow [ ] ( @ ) [ 1; 2 ] 10;; (* [1; 2; 1; 2; 1; 2; 1; 2; 1; 2; 1; 2; 1; 2; 1; 2; 1; 2; 1; 2] *)
 
(* moreThue-Morse unusualsequence *)
Array.init 20032 (fun n -> (1 - pow 1 ( - ) 0 n)/2 lsr 1);;
 
(* 0; 1; 0; 0; 1; [|0; 1; 1; 0; 1; 0; 0; 1; 1; 0; 0; 1; 0; 1; 1; 0; 0; 1; 1; 0;
(*
[|0; 1; 1; 0; 1; 0; 0; 1; 1; 0; 0; 1; 0; 1; 1; 0; 1; 0; 01; 1; 0; 1; 10; 0; 0;1|]
1; 1; 0; 1; 0; 0; 1; 1; 0; 0; 1; 0; 1; 1; 0; 0; 1; 1; 0; 1; 0; 0; 1; 0; 1;
1; 0; 1; 0; 0; 1; 1; 0; 0; 1; 0; 1; 1; 0; 1; 0; 0; 1; 0; 1; 1; 0; 0; 1; 1;
0; 1; 0; 0; 1; 0; 1; 1; 0; 1; 0; 0; 1; 1; 0; 0; 1; 0; 1; 1; 0; 0; 1; 1; 0;
1; 0; 0; 1; 1; 0; 0; 1; 0; 1; 1; 0; 1; 0; 0; 1; 0; 1; 1; 0; 0; 1; 1; 0; 1;
0; 0; 1; 1; 0; 0; 1; 0; 1; 1; 0; 0; 1; 1; 0; 1; 0; 0; 1; 0; 1; 1; 0; 1; 0;
0; 1; 1; 0; 0; 1; 0; 1; 1; 0; 0; 1; 1; 0; 1; 0; 0; 1; 1; 0; 0; 1; 0; 1; 1;
0; 1; 0; 0; 1; 0; 1; 1; 0; 0; 1; 1; 0; 1; 0; 0; 1; 0; 1; 1; 0; 1; 0; 0; 1|]
 
See http://en.wikipedia.org/wiki/Thue-Morse_sequence
*)</lang>
 
</lang>
 
See also [[Matrix-exponentiation_operator#OCaml]] for a matrix usage.
506

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.