create account

Computation Contest #9 [2 SBI] by quantumdeveloper

View this thread on: hive.blogpeakd.comecency.com
· @quantumdeveloper ·
$0.21
Computation Contest #9 [2 SBI]
Here you can solve interesting problems using whatever programming language you like. Also you will earn [SBI](https://steemit.com/@steembasicincome) and sometimes [STEM](https://stemgeeks.net) by doing so.
Also you might learn new things by doing so.
The tasks will be rather hard to solve without a programmable computer and some programming skills, but if you want to add a few million numbers by hand or similar, I would still give you the reward.
*↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓*
# Rules
#### No upvote, No resteem, No follow required!
#### I will give the prize randomly to those who solved the problem.
#### If two pieces of code are to closely related I might consider the later of them as copied which results in no prize for that person.
#### You have 12 days to solve it.
#### Even though this is about computation I will also accept algebraic solutions if you find one.
#### In order to get accepted you need to somehow attach your code.
*↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓*

# Problem
*Imagine you have to write a program for a computer which is not able to multiply numbers and can only do addition, subtraction, comparison and bitwise operations. So you must write your own function to multiply integers.
Imagie further that this program needs to multiply numbers (that can get pretty big) very often, so that processing speed is crucial and the intuitive algorithm of simple repeated addition is not applicable.*

Your task now is to write that function which multiplies two integers without using the "*" operator.

*↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓*

To everyone who already participated in a past contest, come back today and try a new problem(tell me if you don't want to be tagged):
@crokkon @kaeserotor @lallo @ninahaskin @portalmine @tonimontana

In case no one gets a result(which I doubt), I will give away the prize to the person who makes the most constructive description why the problem is too hard in your opinion.

*↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓↑↓*

@contrabourdon sponsors my contests with 2 STEEM weekly.
You can support him by [using a witness vote on untersatz](https://v2.steemconnect.com/sign/account-witness-vote?witness=untersatz&approve=1), so he can further support this and other contests.
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,
👎  , , ,
properties (23)
authorquantumdeveloper
permlinkcomputation-contest-9-2-sbi
categoryprogramming
json_metadata{"tags":["programming","puzzle","contest","stem","steembasicincome","sbi","math","steemstem","steemiteducation","palnet"],"users":["crokkon","kaeserotor","lallo","ninahaskin","portalmine","tonimontana","contrabourdon"],"links":["https://steemit.com/@steembasicincome","https://stemgeeks.net","https://v2.steemconnect.com/sign/account-witness-vote?witness=untersatz&approve=1"],"app":"palnet/0.1","format":"markdown","canonical_url":"undefined/@quantumdeveloper/computation-contest-9-2-sbi"}
created2020-01-01 19:35:27
last_update2020-01-01 19:35:27
depth0
children11
last_payout2020-01-08 19:35:27
cashout_time1969-12-31 23:59:59
total_payout_value0.109 HBD
curator_payout_value0.103 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,300
author_reputation4,456,611,502,865
root_title"Computation Contest #9 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,932,186
net_rshares1,176,720,920,288
author_curate_reward""
vote details (43)
@bootlegbilly · (edited)
https://github.com/billyb2/quantum-developer-contests/blob/master/comp-contest-%239.html
Saves as much computation power as possible by limiting the amount of operations.

Also works for negative multiplication.

Unfortuantely, it's slows down for much larger numbers, and is in general slower since it runs in the browser. It tries to improve efficiency as well as possible, however, by having adding the larger number to itself instead of just picking the first number.
👍  ,
properties (23)
authorbootlegbilly
permlinkre-quantumdeveloper-202012t1547792z
categoryprogramming
json_metadata{"app":"steemit/0.1","format":"markdown+html","community":"esteem.app","links":["https://github.com/billyb2/quantum-developer-contests/blob/master/comp-contest-%239.html"]}
created2020-01-02 20:04:09
last_update2020-01-03 17:17:06
depth1
children2
last_payout2020-01-09 20:04:09
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length471
author_reputation1,522,279,533,235
root_title"Computation Contest #9 [2 SBI]"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,962,401
net_rshares5,378,564,158
author_curate_reward""
vote details (2)
@quantumdeveloper ·
What you did is just implementing "the intuitive algorithm of simple repeated addition" which I mentioned in the problem which is as you correctly discovered very slow because you need `number2` additions.
You need to find something better.

By the way I ignore the speed differences of individual languages in these contests, because the algorithm would still be slow in any other language.
👍  
properties (23)
authorquantumdeveloper
permlinkq3oq0m
categoryprogramming
json_metadata{"app":"steemit/0.1"}
created2020-01-06 12:14:48
last_update2020-01-06 12:14:48
depth2
children1
last_payout2020-01-13 12:14:48
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length391
author_reputation4,456,611,502,865
root_title"Computation Contest #9 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,093,184
net_rshares2,071,072,017
author_curate_reward""
vote details (1)
@bootlegbilly ·
Thanks for the information, I'll work on redoing my answer now!
properties (22)
authorbootlegbilly
permlinkre-quantumdeveloper-202016t13131158z
categoryprogramming
json_metadata{"tags":["esteem"],"app":"esteem/2.2.2-mobile","format":"markdown+html","community":"esteem.app"}
created2020-01-06 18:13:00
last_update2020-01-06 18:13:00
depth3
children0
last_payout2020-01-13 18:13:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length63
author_reputation1,522,279,533,235
root_title"Computation Contest #9 [2 SBI]"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,104,771
net_rshares0
@bootlegbilly ·
Hey @quantumdeveloper, are you still around? I've missed your competitions, they were always
properties (22)
authorbootlegbilly
permlinkre-quantumdeveloper-2020611t122423648z
categoryprogramming
json_metadata{"tags":["programming","puzzle","contest","stem","steembasicincome","sbi","math","steemstem","steemiteducation","palnet"],"app":"esteem/2.2.7-surfer","format":"markdown+html","community":"esteem.app"}
created2020-06-11 16:24:15
last_update2020-06-11 16:24:15
depth1
children0
last_payout2020-06-18 16:24:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length92
author_reputation1,522,279,533,235
root_title"Computation Contest #9 [2 SBI]"
beneficiaries
0.
accountesteemapp
weight300
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id97,904,014
net_rshares0
@esteemapp ·
ESTM Boosting refund to @bootlegbilly! <br>Due to one of these reasons: <br>1. Not posted from eSteem apps. <br>2. Already curated by eSteem team. <br>3. Need bit more improvement on quality of post. <br>4. Might be too old post.<br>5. User already received vote in last couple hours, you can try boosting again afterwhile.<br>[Android](https://play.google.com/store/apps/details?id=app.esteem.mobile.android), [iOS](https://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=1451896376&mt=8), [Windows, Mac, Linux](https://github.com/esteemapp/esteem-surfer/releases)<br>Learn more: https://esteem.app <br>Join our discord: https://discord.me/esteem
properties (22)
authoresteemapp
permlinkre-202015t21948612z
categoryprogramming
json_metadata{"tags":["esteem"],"app":"esteem/2.2.2-welcome","format":"markdown+html","community":"esteem.app"}
created2020-01-05 20:09:51
last_update2020-01-05 20:09:51
depth1
children0
last_payout2020-01-12 20:09:51
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length658
author_reputation420,443,679,514,793
root_title"Computation Contest #9 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,071,572
net_rshares0
@mapxv ·
A member bonus $trendotoken tip, and !trendovoter, for @quantumdeveloper from MAPXV! These bonuses are for members, selected at random, and last for a few days.

Also consider our [MAPR fund](https://steem-engine.com/?p=market&t=MAPR) and [MAXUV](https://steem-engine.com/?p=market&t=MAXUV) vote bonds too.
MAP Steem Fintech: growing your STEEM without SP.
properties (22)
authormapxv
permlinkre-computation-contest-9-2-sbi-20200101t194312z
categoryprogramming
json_metadata"{"app": "rewarding/0.1.5"}"
created2020-01-01 19:43:15
last_update2020-01-01 19:43:15
depth1
children1
last_payout2020-01-08 19:43:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length361
author_reputation9,809,854,088,378
root_title"Computation Contest #9 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,932,353
net_rshares0
@trendotoken ·
Congratulations @mapxv, you successfuly trended the post shared by @quantumdeveloper!
@quantumdeveloper will receive <b>4.72741312</b> [TRDO](https://steem-engine.com/?p=history&t=TRDO) & @mapxv will get <b>3.15160875</b> [TRDO](https://steem-engine.com/?p=history&t=TRDO) curation in 3 Days from Post Created Date!

<b>"Call [TRDO](https://steem-engine.com/?p=history&t=TRDO), Your Comment Worth Something!"</b>
---
<sup>To view or trade TRDO go to [steem-engine.com](https://steem-engine.com/?p=market&t=TRDO)
Join [TRDO Discord Channel](https://discord.gg/wySP8T9) or Join [TRDO Web Site](http://www.trendotoken.info/)</sup>
properties (22)
authortrendotoken
permlinkre-mapxv-re-computation-contest-9-2-sbi-20200101t194312z-20200101t194326522z
categoryprogramming
json_metadata{"tags":["comments-scot","trendo-bot"],"app":"comments-scot/1.1","format":"markdown"}
created2020-01-01 19:43:27
last_update2020-01-01 19:43:27
depth2
children0
last_payout2020-01-08 19:43:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length628
author_reputation5,546,209,053,433
root_title"Computation Contest #9 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,932,357
net_rshares0
@torsteoe ·
I'll share with you a solution that I found in an old exam: 
https://github.com/gravlaks/multiplication-recursive/blob/master/multiplication.py

It's a neat recursive solution, but sadly doesn't solve your problem as big numbers lead to "maximum recursion depth error" and computation is slow.
👍  ,
properties (23)
authortorsteoe
permlinkq3j20y
categoryprogramming
json_metadata{"links":["https://github.com/gravlaks/multiplication-recursive/blob/master/multiplication.py"],"app":"steemit/0.1"}
created2020-01-03 10:48:36
last_update2020-01-03 10:48:36
depth1
children1
last_payout2020-01-10 10:48:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length293
author_reputation5,804,783,543
root_title"Computation Contest #9 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,980,392
net_rshares7,050,781,108
author_curate_reward""
vote details (2)
@quantumdeveloper · (edited)
What you did is just implementing "the intuitive algorithm of simple repeated addition" which I mentioned in the problem which is as you correctly discovered very slow because you need b calls to func1(you could have written there just a+b instead of func1(a,b). Addition is allowed).

You might also want to think about what happens when you use negative numbers.
👍  
properties (23)
authorquantumdeveloper
permlinkq3opmk
categoryprogramming
json_metadata{"app":"steemit/0.1"}
created2020-01-06 12:06:21
last_update2020-01-06 12:08:45
depth2
children0
last_payout2020-01-13 12:06:21
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length364
author_reputation4,456,611,502,865
root_title"Computation Contest #9 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,092,989
net_rshares506,203,211
author_curate_reward""
vote details (1)
@trendotoken ·
Congratulations @quantumdeveloper, your post successfully recieved <b>4.72741312</b> [TRDO](https://steem-engine.com/?p=history&t=TRDO) from below listed TRENDO callers:<br>

>	<sup>@mapxv earned : **3.15160875** [TRDO](https://steem-engine.com/?p=history&t=TRDO) curation</sup> 

---
<sup>To view or trade TRDO go to [steem-engine.com](https://steem-engine.com/?p=market&t=TRDO)
Join [TRDO Discord Channel](https://discord.gg/wySP8T9) or Join [TRDO Web Site](http://www.trendotoken.info/)</sup>
properties (22)
authortrendotoken
permlinkre-quantumdeveloper-computation-contest-9-2-sbi-20200104t201733257z
categoryprogramming
json_metadata{"tags":["trdo","trendo-bot"],"app":"comments-scot/1.1","format":"markdown"}
created2020-01-04 20:18:42
last_update2020-01-04 20:18:42
depth1
children0
last_payout2020-01-11 20:18:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length495
author_reputation5,546,209,053,433
root_title"Computation Contest #9 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id94,027,876
net_rshares0
@trendovoter ·
Congratulations @mapxv, <b>50.28%</b> upvote has been shared with your successful call on the post that shared by @quantumdeveloper!

---
<sup>Support <b>@trendotoken</b> projects by delegating : <b>[100SP](https://beta.steemconnect.com/sign/delegateVestingShares?delegator=YOURUSERNAME&delegatee=trendovoter&vesting_shares=100.000%20SP)</b> , <b>[200SP](https://beta.steemconnect.com/sign/delegateVestingShares?delegator=YOURUSERNAME&delegatee=trendovoter&vesting_shares=200.000%20SP) , <b>[500SP](https://beta.steemconnect.com/sign/delegateVestingShares?delegator=YOURUSERNAME&delegatee=trendovoter&vesting_shares=500.000%20SP)</b> , <b>[1000SP](https://beta.steemconnect.com/sign/delegateVestingShares?delegator=YOURUSERNAME&delegatee=trendovoter&vesting_shares=1000.000%20SP)</b> , <b>[2000SP](https://beta.steemconnect.com/sign/delegateVestingShares?delegator=YOURUSERNAME&delegatee=trendovoter&vesting_shares=2000.000%20SP)</b></sup>
properties (22)
authortrendovoter
permlinkre-quantumdeveloper-computation-contest-9-2-sbi-20200101t194326896z
categoryprogramming
json_metadata{"tags":["trdo","newsteem"],"app":"trdo-voter/1.0","format":"markdown"}
created2020-01-01 19:43:27
last_update2020-01-01 19:43:27
depth1
children0
last_payout2020-01-08 19:43:27
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length944
author_reputation58,041,103,589
root_title"Computation Contest #9 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id93,932,358
net_rshares0