- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
VERY literal Javascript implementation:
Admin
I'm a latecomer. Still fun to do.
Code handles negative values OK.
2 VB.Net ways:
Way 1 - Recursive:
Way 2 - While Loop:
Admin
unsigned int mu_ru(a, b) { unsigned int c = 0;
}
Admin
Admin
Java
Admin
public class Praxis {
public static int multiply(int a, int b) { if(a < 0) { a *= -1; b *= -1; }
}
public static void main(String[] args) { int a = Integer.parseInt(args[0]); int b = Integer.parseInt(args[1]); int c = multiply(a, b); System.out.println(a + " x " + b + " = " + c); }
}
Admin
Maude solution
Admin
int ru_mult(int a, int b) { int result = 0; do { if(a % 2) result += b; b <<= 1; } while(a >>= 1); return result; }
i can't do it smaller + faster than that..
Admin
this doesn't work for me..
Admin
I'm teaching myself Clojure, so I created a version of this in Clojure using sequence transformations:
Admin
Kind of late but:
Admin
Plus size beachchanel sale and swimwear chanel jewelryhas been especially made to support the contours of your body. In plus size swim suits and bikinis,chanel Brooches you can feel chanelchanel jewelry sale necklaces for salerelaxed and comfortable on the beach. Finding a beautifulchanel jewelry for sale wedding gown is getting easier too. With the availability of plus size bridal wear, kisschanel Banglesyour worries goodbye. Plus size bridal wear is readily available in most department chanel Braceletsand bridal stores with a large range to chose from. There are plentychanel Earrings of plus size designs and clothing available in the shops and alternatively mailchanel Necklaces order from catalogues or from the Internet. So you can now shop till you drop.
Admin
#!usr/bin/perl6 -e
Int $i; Int $j; Int @i; Int @j; $i = +(input());
$j = +(input());
while i != 1 { @i ,= $i; @j ,= $j; $i +>= 1; $j +<= 1; } @j = gather for @i Z @j -> $test, $result { take $result if $test % 2 } say([+] @j);
Admin
import java.io.DataInputStream; import java.io.IOException; public class PergjysmoShumezo {
long k2=System.currentTimeMillis();
{ System.out.println("Koha e e ekzekutimit eshte k2-k1=" +(k2-k1)); } }
Admin
x is the left argument, y the right argument.
x bs y: bitshift (x<<y) y#0 A list of y 0's. (#:x) The binary representation of x. , Join these together. #. Convert binary list to a number.
x rm y: russian peasant multiplication. |.#:y Reverse binary of x (lowest bit first) I. Get indices of all 1's y bs"0 Bitshift each element in the list with y as left argument. +/ Sum.
Admin
captcha: "iusto" = I have gusto.
Admin
function rpm(x,y){return x?rpm(x>>1,y+y)+y*(x&1):0}
Very tweetable JavaScript indeed! :)
Admin
A solution in Factor programming language:
For integers, it produces the correct result so long as the second argument is non-negative.
Admin
I got a Clojure solution here. (I don't even know if the post is being still watched)
Admin
I wrote it in Befunge. Hopefully nothing was changed when I copied it...