create account

Computation Contest #6 [2 SBI] by quantumdeveloper

View this thread on: hive.blogpeakd.comecency.com
· @quantumdeveloper · (edited)
$0.09
Computation Contest #6 [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 4 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
Today I want to give you a problem you can't just solve with brute force. You need to simplify the problem first:

Find the smallest integer number x that satisfies the following equations:
```
x mod 9 = 4
x mod 10 = 5
x mod 11 = 6
x mod 12 = 7
x mod 13 = 8
:
:
:
x mod 125 = 120
x mod 126 = 121
x mod 127 = 122
x mod 128 = 123
```

Tip: The number is **big**! Normal integers might overflow!

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

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 @tonimontana @ninahaskin

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-6-2-sbi
categoryprogramming
json_metadata{"tags":["programming","puzzle","contest","stem","steembasicincome","sbi","math","steemstem","steemiteducation","palnet"],"users":["crokkon","kaeserotor","tonimontana","ninahaskin","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-6-2-sbi"}
created2019-11-24 21:32:03
last_update2019-11-24 21:39:00
depth0
children7
last_payout2019-12-01 21:32:03
cashout_time1969-12-31 23:59:59
total_payout_value0.045 HBD
curator_payout_value0.040 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length2,139
author_reputation4,456,611,502,865
root_title"Computation Contest #6 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,801,155
net_rshares529,743,268,008
author_curate_reward""
vote details (33)
@crokkon · (edited)
properties (23)
authorcrokkon
permlinkq1l2qb
categoryprogramming
json_metadata"{"app": ""}"
created2019-11-26 15:51:39
last_update2022-09-17 20:22:54
depth1
children2
last_payout2019-12-03 15:51:39
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_length1
author_reputation81,214,366,861,104
root_title"Computation Contest #6 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,852,464
net_rshares10,132,220,766
author_curate_reward""
vote details (2)
@portalmine · (edited)
\*Calculating in fractions of a second\*  😂
properties (22)
authorportalmine
permlinkre-crokkon-q1lggj
categoryprogramming
json_metadata{"tags":["programming"],"app":"steempeak/2.1.1"}
created2019-11-26 20:48:21
last_update2019-11-26 20:49:27
depth2
children0
last_payout2019-12-03 20:48: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_length43
author_reputation940,579,902,362
root_title"Computation Contest #6 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,859,609
net_rshares0
@quantumdeveloper ·
$0.02
You should try to make more optimizations like the one you did for 128.

By the way: A good solution won't run more than a few minutes.
👍  ,
properties (23)
authorquantumdeveloper
permlinkq1lckh
categoryprogramming
json_metadata{"app":"steemit/0.1"}
created2019-11-26 19:24:18
last_update2019-11-26 19:24:18
depth2
children0
last_payout2019-12-03 19:24:18
cashout_time1969-12-31 23:59:59
total_payout_value0.011 HBD
curator_payout_value0.011 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length135
author_reputation4,456,611,502,865
root_title"Computation Contest #6 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,858,017
net_rshares146,468,844,212
author_curate_reward""
vote details (2)
@portalmine · (edited)
So if I'm right, one solution for all equations is ```x = !128/!8-5``` as the right side is always 5 smaller then the divider on the right side and the equations cold be rewritten as ```x+5 mod d = 0``` so 9 to 128 have to divide x+5. When multiplying all the dividers together, the result can be divided by all of them and is exactly 5 bigger than x.
But this obviously is not the smallest number, because many numbers from 9 to 128 are multiples (e.g. 9 and 18) so we only need to multiply with the biggest multiple below 129.
My program simply tests if x is a multiple of the divider. If it's not, it multiplies x to the divider making it a divider. This procedure is repeated with dividers from 128 to 9 downwards.
```
x = 1
while True:
    for i in range(128, 8, -1):
        if x % i == 0:
            pass
        else:
            x *= i
            break
    else:
        x -= 5
        break
```
So ```x = 3692046484038964353473548580043636599281147520791807426559995```


If I win, please send the rewards to @portalvotes
👍  
properties (23)
authorportalmine
permlinkre-quantumdeveloper-q1lgb1
categoryprogramming
json_metadata{"tags":["programming"],"app":"steempeak/2.1.1"}
created2019-11-26 20:45:03
last_update2019-11-26 20:51:24
depth1
children1
last_payout2019-12-03 20:45:03
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_length1,033
author_reputation940,579,902,362
root_title"Computation Contest #6 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,859,552
net_rshares4,808,121,721
author_curate_reward""
vote details (1)
@quantumdeveloper ·
$0.02
Your solution is good, but it isn't the smallest. There one which is 5 orders of magnitude smaller.
👍  ,
properties (23)
authorquantumdeveloper
permlinkq1mwda
categoryprogramming
json_metadata{"app":"steemit/0.1"}
created2019-11-27 15:29:36
last_update2019-11-27 15:29:36
depth2
children0
last_payout2019-12-04 15:29:36
cashout_time1969-12-31 23:59:59
total_payout_value0.011 HBD
curator_payout_value0.011 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length99
author_reputation4,456,611,502,865
root_title"Computation Contest #6 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,880,754
net_rshares143,920,274,917
author_curate_reward""
vote details (2)
@steemitboard ·
Congratulations @quantumdeveloper! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

<table><tr><td><img src="https://steemitimages.com/60x70/http://steemitboard.com/@quantumdeveloper/votes.png?201911251632"></td><td>You distributed more than 1500 upvotes. Your next target is to reach 1750 upvotes.</td></tr>
</table>

<sub>_You can view [your badges on your Steem Board](https://steemitboard.com/@quantumdeveloper) and compare to others on the [Steem Ranking](https://steemitboard.com/ranking/index.php?name=quantumdeveloper)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>


To support your work, I also upvoted your post!


> You can upvote this notification to help all Steem users. Learn how [here](https://steemit.com/steemitboard/@steemitboard/http-i-cubeupload-com-7ciqeo-png)!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-quantumdeveloper-20191125t164644000z
categoryprogramming
json_metadata{"image":["https://steemitboard.com/img/notify.png"]}
created2019-11-25 16:46:42
last_update2019-11-25 16:46:42
depth1
children0
last_payout2019-12-02 16:46: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_length912
author_reputation38,975,615,169,260
root_title"Computation Contest #6 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,824,237
net_rshares0
@tonimontana · (edited)
I am a bit late but here is my solution. The equations can written like x mod 9=-5, x mod 10=-5,
x mod 11=-5...
So we just need to look for the least common multiple of 9 10 ... 128 and subtract 5. That can be done for example by iteratively computing the lcm of 2 numbers I think . My answer is 13353756090997411579403749204440236542538872688049071995
The python code is below
```python
def gcd(x, y): 
  
   while(y): 
       x, y = y, x % y 
  
   return x 
a = []  
for x in range(9,129):
    a.append(x)
lcm=1
for x in a:
    lcm=int(abs(lcm*x))//int(gcd(lcm,x))
    print(lcm%x,lcm)

for x in range(9,129):
    if((lcm-5)%x==x-5):
        pass
    else:
        print("Nope")
print(lcm-5)
👍  ,
properties (23)
authortonimontana
permlinkre-quantumdeveloper-q1p5z3
categoryprogramming
json_metadata{"tags":["programming"],"app":"steempeak/2.2.3"}
created2019-11-28 20:52:15
last_update2019-11-29 18:19:18
depth1
children0
last_payout2019-12-05 20:52: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_length694
author_reputation4,423,485,388,975
root_title"Computation Contest #6 [2 SBI]"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id92,917,509
net_rshares8,980,847,896
author_curate_reward""
vote details (2)