# [Question] Mathematics × Programming Competition #8 [問題] 數學 × 程式編寫比賽 (第八回)

in #contest4 years ago (edited)

## Good News!

### Thanks to @steemstem , the sponsored prize has been doubled!

Please refer to the "Prizes" section for details.

## Mathematics × Programming Competition #8

Designed by @nicolemoker

## Question

Ken has a four-digit calculator which displays numbers using the seven-segment-display. For example the number 159 is displayed as

###### Note that 159 is displayed as 0159

Suppose we want to use non-transparent cards to represent all the possible 4-digit numbers from 0000 to 9999. Each card will show one 4-digit number, where the numbers are written using seven-segment-display. However when some cards are rotated 180°, a new number can be formed. For example when the card 0159 is rotated 180°, it becomes 6510.

###### Note that it is acceptable for the ‘1’ to be displayed on the left hand side

Considering the possibility of rotating a card 180°, what is the minimum number of non-transparent cards required to represent all the possible 4-digit numbers from 0000 to 9999?

## Rules

• This competition will last for 7 days. After that, no more submission will be accepted.
• Participants who submit the answer as a comment below this post will be disqualified.
• Participants can submit an unlimited number of solutions, however only the latest answer will be considered.
• You have to upvote this post in order to be eligible for the competition.

## Prizes

• The three fastest contestants would win the first prize, second prize and third prize respectively.
• Other contestants who gave the correct answer would enter a lucky draw. 5 winners will be drawn.
• Those who resteemed this post will have 400% higher chance to win in the lucky draw.
• @kenchung reserves all the rights to disqualify any suspected cheating players and to decide the distribution of prizes among the winner(s).
Name of prizeMax no. of prizesSBDSP (sponsored by @steemstem ! )
First prize1SBD payout of this post / n15
Second prize1SBD payout of this post / n10
Third prize1SBD payout of this post / n5
Consolation prize5SBD payout of this post / n0

where n is the total number of winners in this competition. n = min (number of participants getting the correct answer, 8).

The steemSTEM project (@steemstem) is a community-supported project aiming to increase the quality and the visibility of STEM (STEM is the acronym for Science, Technology, Engineering and Mathematics) articles on Steemit. Please support steemSTEM by following @steemstem and joining the chat channel. You can also consider joining a private curation trail to further support steemSTEM by asking about it in the chat channel. In order to further promote the use of the chat channel, I will stop announcing the time of next competition via a post. Instead I will announce the time in advance in the chat channel!

## 數學 × 程式編寫比賽 (第八回)

Designed by @nicolemoker

## 問題

Ken有一部只能顯示四位數的計算器，它使用七段顯示來顯示數字。例如，159顯示為

## 規則

• 此比賽為時7天，其後將不會再接受新答案。
• 嚴禁在回覆公開答案，否則將被取消資格。
• 參加者可以重覆提交答案，但比賽終結時只會考慮最後提交的答案。
• 你必須upvote此帖方能參加比賽。

## 獎品

• 最快給出正確答案的三名參賽者將分別獲得一等獎、二等獎和三等獎。
• 其他給出正確答案的參賽者將可參與抽獎。5名參賽者將被選出。
• Resteem此帖文者將有額外400％的得獎機會。
• 本人保留一切最終權利，包括但不限於取消任何疑似作弊者的資格並決定獲獎者的獎勵分配。

steemSTEM（@steemstem）是一個由steemit社群支持的項目，旨在宣傳STEM（STEM是科學，技術，工程和數學的首字母縮略詞）。 請追蹤 @steemSTEM 以及加入聊天頻道來支持steemSTEM。你還可以透過加入自動點讚系統來在為了進一步支持steemSTEM，詳情請在聊天頻道內向負責人士查詢。為了推廣聊天頻道的使用，我將不再透過發文來宣布下一場比賽的時間，我會在聊天頻道中提前公佈比賽時間。

Sort:
4 years ago (edited)

https://steemit.com/cn/@speeding/one-line-python-math-programming

print(int(sum(map(lambda d: 0.5 if d != ''.join(map(lambda i:'012xx59x86'[int(i)], d[::-1])) and ''.join(map(lambda i:'012xx59x86'[int(i)], d[::-1])) in ['%04d' % x for x in range(0, 10000)] else 1 , ['%04d' % x for x in range(0, 10000)]))))

submitted, voted and resteeeeeeeeeeeeeeem!

thanks for joining (again) ! ;)

Nice! I submitted my answer! 😼

great! :)

Am I late? submitted and resteemed~~

not quite late i guess, but even if the first 3 spots have been taken, you can still have the chance to get a random prize!

4 years ago (edited)

It seems it's not so late. I decide to reply first to get a nice position:)
Btw, I see there may be a mistake on competition period
"13/10/2017 UTC 15:00 - 20/11/2017 UTC 15:00"
I think it should be:
"13/10/2017 UTC 15:00 - 20/10/2017 UTC 15:00".

just to remind you that your final position depends on the time of your answer submission through the google form, not the timestamp of your comment here ;)

thanks for spotting the mistake, I have just updated it :)

I hate maths, I'm probably lost here. Let me come and be going 🏃🏃🏃🏃🚶🚶

sorry to hear that you hate maths, hopefully this question did not make you hate it more! haha

thanks for joining!

luckily i saw your announcement 1 hour ago in the steemstem channel, so I can catch your post on time!

ye if you join the steemstem channel you would know the time of competition in advance!

submitted one day later. Hope my answer is correct and luckily get the prize=]
btw I've use some excel function to do it. Hope my logic is correct haha.

ye I think it is possible to use Excel to solve this question :) hope that you can win!

May I use contents of this post in my blog for illustrating the solution?(in the future, not now). I will comment where I quote them from.

ye sure!

I'm not able to answer this question but I'll resteem this because it's a good question

thanks so much!

waiting to see the answer :) hopefully got it right