Good News!

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

好消息！

感謝 @steemstem 慷慨支持，贊助金額由是次比賽起增加一倍！

Mathematics × Programming Competition #8

^{Designed by @nicolemoker}

13/10/2017 UTC 15:00 - 20/10/2017 UTC 15:00

*For Chinese version please scroll to the bottom. 中文版請見文末。*

## 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?

Answer submission

Please submit your answer through this link.

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 prize | Max no. of prizes | SBD | SP (sponsored by @steemstem ! ) |
---|---|---|---|

First prize | 1 | SBD payout of this post / n | 15 |

Second prize | 1 | SBD payout of this post / n | 10 |

Third prize | 1 | SBD payout of this post / n | 5 |

Consolation prize | 5 | SBD payout of this post / n | 0 |

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}

13/10/2017 UTC 15:00 - 20/10/2017 UTC 15:00

## 問題

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

###### 注意159顯示為0159

假設我們要使用非透明卡紙來表示從0000到9999所有可能的4位數字。每張卡紙將顯示一個4位數字，而這些數字是使用七段顯示器所寫成的。留意當某些卡片旋轉180°時，可以形成新的數字。例如當卡片0159旋轉180°時，它將變成6510。

###### 注意'1'顯示在左側亦可接受

考慮到將卡紙旋轉180°的可能性，最少需要多少張卡紙才能表示從0000到9999所有可能的4位數字？

答案提交

請經此連結提交答案。

規則

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

獎品

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

獎項 | 獎項數目 | SBD | SP (由 @steemstem 贊助！) |
---|---|---|---|

一等獎 | 1 | 此帖文的 SBD 金額 / n | 15 |

二等獎 | 1 | 此帖文的 SBD 金額 / n | 10 |

三等獎 | 1 | 此帖文的 SBD 金額 / n | 5 |

安慰獎 | 5 | 此帖文的 SBD 金額 / n | 0 |

其中 *n* 是本比賽中得獎者的總數。*n* = min (答對人數, 8)。

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

justyy (70)· 7 months agoAnswer Here!

speeding (52)· 7 months ago用一行python语句把这道题解了，我是不是疯了？

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)]))))

justyy (70)· 7 months ago这个可以有，PYTHON一向以一行代码解题著称，不过写出来的代码没有维护性，很难改，用于快速刷题可以的。

speeding (52)· 7 months ago只是好玩

justyy (70)· 7 months agosubmitted, voted and resteeeeeeeeeeeeeeem!

kenchung (63)· 7 months agothanks for joining (again) ! ;)

armandocat (63)· 7 months agoNice! I submitted my answer! 😼

kenchung (63)· 7 months agogreat! :)

breathewind (62)· 7 months agoIt 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".

kenchung (63)· 7 months agojust 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 ;)

breathewind (62)· 7 months agoThank you, already summited

kenchung (63)· 7 months agothanks for spotting the mistake, I have just updated it :)

speeding (52)· 7 months ago他说你的日期写错了，13/10/2017 UTC 15:00 - 20/11/2017 UTC 15:00，截止日期应该是 20/10/2017 UTC 15:00 吧？

kenchung (63)· 7 months ago對，剛剛才注意到他的留言，已改正了，謝謝！

enzor (53)· 7 months agoI'm not able to answer this question but I'll resteem this because it's a good question

kenchung (63)· 7 months agothanks so much!

firstamendment (52)· 7 months agosure you can. you can write them all down one at a time, and hope you can identify a pattern (or hope you don't make a counting error). Or, you can learn how to code. This is a simple one through coding.

cifer (58)· 7 months agoAm I late? submitted and resteemed~~

kenchung (63)· 7 months agonot 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!

heimindanger (66)· 7 months agoAnswered!

kenchung (63)· 7 months agothanks for joining!

johnbakare (35)· 7 months agoI hate maths, I'm probably lost here. Let me come and be going 🏃🏃🏃🏃🚶🚶

kenchung (63)· 7 months agosorry to hear that you hate maths, hopefully this question did not make you hate it more! haha

firstamendment (52)· 7 months agocommenting so I can resteem later, if I remember and am able to.

kenchung (63)· 7 months agogreat :) thanks for joining

firstamendment (52)· 7 months agoIt won't let me resteem. Timed out the other day. Oh well.

leedslemon (51)· 7 months agosubmitted 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.

kenchung (63)· 7 months agoye I think it is possible to use Excel to solve this question :) hope that you can win!

speeding (52)· 7 months ago这期看起来比较简单，还是用程序方便

kenchung (63)· 7 months ago沒錯，這次相對容易，總不能每次都設定得太困難，不然把大家都嚇走了，哈哈

breathewind (62)· 7 months agoMay 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.

kenchung (63)· 7 months agoye sure!

vincentyip (55)· 7 months agosubmitted my answer :)

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

kenchung (63)· 7 months agoye if you join the steemstem channel you would know the time of competition in advance!

challk (39)· 7 months agowaiting to see the answer :) hopefully got it right

vincentyip (55)· 7 months agomy answer here: https://steemit.com/contest/@vincentyip/676hxw :)