• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 08:16
CEST 14:16
KST 21:16
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
TL.net Map Contest #21: Voting7[ASL20] Ro4 Preview: Descent11Team TLMC #5: Winners Announced!3[ASL20] Ro8 Preview Pt2: Holding On9Maestros of the Game: Live Finals Preview (RO4)5
Community News
Weekly Cups (Oct 6-12): Four star herO65.0.15 Patch Balance Hotfix (2025-10-8)80Weekly Cups (Sept 29-Oct 5): MaxPax triples up3PartinG joins SteamerZone, returns to SC2 competition325.0.15 Balance Patch Notes (Live version)119
StarCraft 2
General
Ladder Impersonation (only maybe) Revisiting the game after10 years and wow it's bad 5.0.15 Patch Balance Hotfix (2025-10-8) TL.net Map Contest #21: Voting How to Block Australia, Brazil, Singapore Servers
Tourneys
WardiTV Mondays RSL Offline Finals Dates + Ticket Sales! SC4ALL $6,000 Open LAN in Philadelphia Crank Gathers Season 2: SC II Pro Teams LiuLi Cup - September 2025 Tournaments
Strategy
Custom Maps
External Content
Mutation # 495 Rest In Peace Mutation # 494 Unstable Environment Mutation # 493 Quick Killers Mutation # 492 Get Out More
Brood War
General
[Interview] Grrrr... 2024 BW General Discussion Pros React To: BarrackS + FlaSh Coaching vs SnOw Question regarding recent ASL Bisu vs Larva game BW caster Sayle
Tourneys
[ASL20] Semifinal B [Megathread] Daily Proleagues [ASL20] Semifinal A SC4ALL $1,500 Open Bracket LAN
Strategy
Current Meta Relatively freeroll strategies BW - ajfirecracker Strategy & Training Siegecraft - a new perspective
Other Games
General Games
Dawn of War IV Stormgate/Frost Giant Megathread Nintendo Switch Thread ZeroSpace Megathread Path of Exile
Dota 2
Official 'what is Dota anymore' discussion LiquidDota to reintegrate into TL.net
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Deck construction bug Heroes of StarCraft mini-set
TL Mafia
SPIRED by.ASL Mafia {211640} TL Mafia Community Thread
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Men's Fashion Thread Sex and weight loss
Fan Clubs
The herO Fan Club! The Happy Fan Club!
Media & Entertainment
[Manga] One Piece Series you have seen recently... Anime Discussion Thread Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion MLB/Baseball 2023 NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
SC2 Client Relocalization [Change SC2 Language] Linksys AE2500 USB WIFI keeps disconnecting Computer Build, Upgrade & Buying Resource Thread
TL Community
The Automated Ban List Recent Gifted Posts
Blogs
Rocket League: Traits, Abili…
TrAiDoS
Inbreeding: Why Do We Do It…
Peanutsc
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1269 users

[SC2B Key Contest]Math challenge

Blogs > yh8c4
Post a Reply
1 2 3 Next All
yh8c4
Profile Blog Joined July 2009
108 Posts
Last Edited: 2010-05-02 01:01:04
May 01 2010 22:18 GMT
#1
contest is over, winner is hamster1800

Original problem was taken from here: http://projecteuler.net/index.php?section=problems&id=290

Solution:

+ Show Spoiler +


ok, the key is yours:

xxxxxx-xxxx-xxxxxx-xxxx-xxxxxx

have fun

-----------------------------------------
Original Message:
Sure thing
9090754242258600
1710153888867000

-----------------------------------------
Original Message:
could you give me 2 examples for x for which ds(x) = ds(x * 137)?

-----------------------------------------
Original Message:
Answer =
20444710234716473

Solution is a dynamic programming algorithm. State is based on the last k digits of the number, lazily computing the digit sum of 137*x digit by digit, storing the next 4 digits to the left of the last k digits (using the fact that 9*137 + 99 < 10000). I iterate through the values of k from 0 to 17, increasing it by one each time (so that at the end we have the values for 18), computing the number of numbers x for which the next 4 digits to the left are "a" and the difference between ds(x) and ds(137*x) (up to the last k digits) is "b".

Code below:

#include<cstdio>
#include<cstdlib>

using namespace std;

int main() {
long long **now, **next;
now = new long long*[10000];
next = new long long*[10000];
for(int i = 0; i<10000; i++) {
now[i] = new long long[401];
next[i] = new long long[401];
now[i] += 200;
next[i] += 200;
for(int j = -200; j<=200; j++) {
now[i][j] = next[i][j] = 0;
}
}
now[0][0] = 1;
for(int i = 0; i<18; i++) {
for(int j = 0; j<10000; j++) {
for(int k = -200; k<=200; k++) {
next[j][k] = 0;
}
}
for(int a = 0; a<10000; a++) {
for(int b = -162; b<=162; b++) {
for(int d = 0; d<=9; d++) {
int na = a/10 + 137*d, nb = b - a%10 + d;
next[na][nb] += now[a][b];
}
}
}
long long **t = now;
now = next;
next = t;
}
long long ans = 0;
for(int i = 0; i<10000; i++) {
for(int j = -200; j<=200; j++) {
int a = i, b = j;
while(a != 0) {
b -= a%10;
a/=10;
}
if(b == 0) {
ans += now[i][j];
}
}
}
printf("%lld\n",ans);
}




----------------------


I dont know whether there is still a high demand for beta keys, but I received another friend invite key, which you can win by solving the following challenge:

Let x be an integer equal to or greater than 0 and smaller than 1000000000000000000 (10^18).

Let ds(x) be the digit sum of x, i.e. ds(123) = 1 + 2 + 3 = 6

For how many distinct x is ds(x) = ds(137 * x)?

The first one to pm me a) the correct answer and b) a little explanation (e.g. source code) how to find the solution will receive a beta key.

Once I receive a solution, I'll reply whether it's correct or not. If it's not correct you can try again.

Good luck!

edit 1: The solution is NOT 1!
edit 2: ds(solution) = 59


zealing
Profile Blog Joined January 2009
Canada806 Posts
May 01 2010 22:21 GMT
#2
can't you just give me the key? i skiped school to play BW so i don't know math, could i just beat you 1v1 Destination BW for the key? its all i got
Think you got lag? It took Jesus 3 days to respawn.
yh8c4
Profile Blog Joined July 2009
108 Posts
May 01 2010 22:25 GMT
#3
On May 02 2010 07:21 zealing wrote:
can't you just give me the key? i skiped school to play BW so i don't know math, could i just beat you 1v1 Destination BW for the key? its all i got


unfortunately, beating me in bw is anything but a challenge and thus I can't reward you with a beta key for that
Sadistx
Profile Blog Joined February 2009
Zimbabwe5568 Posts
May 01 2010 22:27 GMT
#4
Bah, I wish a java SDE lying around, i could tell you in less than a minute :/

This is so easy if you have any programming thing lying around.
Lightwip
Profile Blog Joined April 2010
United States5497 Posts
May 01 2010 22:28 GMT
#5
I might try to write a program to do this.
If you are not Bisu, chances are I hate you.
Shrine
Profile Blog Joined April 2010
Australia107 Posts
May 01 2010 22:37 GMT
#6
11
Hell is empty, All the devils are here.
yh8c4
Profile Blog Joined July 2009
108 Posts
May 01 2010 22:37 GMT
#7
yes, writing a program is a good idea, but be aware that 10^18 is really big
Lightwip
Profile Blog Joined April 2010
United States5497 Posts
May 01 2010 22:48 GMT
#8
Yeah, I'm not sure that would even fit in a long int.
If you are not Bisu, chances are I hate you.
Sharkified
Profile Joined January 2009
Canada254 Posts
May 01 2010 22:52 GMT
#9
On May 02 2010 07:27 Sadistx wrote:
Bah, I wish a java SDE lying around, i could tell you in less than a minute :/

This is so easy if you have any programming thing lying around.


Nah it takes forever to do it, would have to find a complicated way of doing it, then rather just learn maths.
yh8c4
Profile Blog Joined July 2009
108 Posts
May 01 2010 22:56 GMT
#10
On May 02 2010 07:37 Shrine wrote:
11


wrong
JonnyWhy
Profile Blog Joined May 2010
Canada94 Posts
May 01 2010 22:57 GMT
#11
43?
Say something juicy.
Sharkified
Profile Joined January 2009
Canada254 Posts
May 01 2010 23:00 GMT
#12
Is it a one try thing ?
JonnyWhy
Profile Blog Joined May 2010
Canada94 Posts
May 01 2010 23:03 GMT
#13
On May 02 2010 08:00 Sharkified wrote:
Is it a one try thing ?


On May 02 2010 07:18 yh8c4 wrote:
Once I receive a solution, I'll reply whether it's correct or not. If it's not correct you can try again.


Say something juicy.
yh8c4
Profile Blog Joined July 2009
108 Posts
May 01 2010 23:04 GMT
#14
no, this is not limited to 1 try, but stop just posting or pming a single number. to receive the key you must have the correct answer AND an explanation why your answer is correct.
yh8c4
Profile Blog Joined July 2009
108 Posts
Last Edited: 2010-05-01 23:12:07
May 01 2010 23:06 GMT
#15
here's a little hint:

let cs be the correct solution. ds(cs) = 59.
Synthesis
Profile Joined August 2008
Canada167 Posts
May 01 2010 23:08 GMT
#16
42.

Source
Sadistx
Profile Blog Joined February 2009
Zimbabwe5568 Posts
May 01 2010 23:09 GMT
#17
On May 02 2010 08:08 Synthesis wrote:
42.

Source


That joke got old the first 1000 times people used it.
Nehsb
Profile Joined May 2009
United States380 Posts
May 01 2010 23:09 GMT
#18
Hmmm, 137 | 10001, 99999999, and 10^12 + 1.

Might be useful?

Might be able to use that to cut down the numbers you have to search...
TwilightStar
Profile Blog Joined August 2009
United States649 Posts
May 01 2010 23:19 GMT
#19
3.76
(5)Twilight Star.scx --------- AdmiralHoth: There was one week when I didn't shave for a month.
Sadistx
Profile Blog Joined February 2009
Zimbabwe5568 Posts
May 01 2010 23:24 GMT
#20
From what I understand, it will be a pretty big number, around 29000000000000000.

I have no means of actually solving this without getting a programming language that handles huge numbers and writing code for it.

I'm sure one of the math majors on here has a better way than brute forcing it.
1 2 3 Next All
Please log in or register to reply.
Live Events Refresh
Wardi Open
11:00
WardiTV Mondays #56
WardiTV517
TKL 216
IndyStarCraft 93
CranKy Ducklings88
Rex65
LiquipediaDiscussion
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko237
TKL 216
SortOf 105
IndyStarCraft 97
Rex 66
StarCraft: Brood War
Britney 37567
Calm 7026
Rain 3565
Larva 2810
Bisu 1546
Horang2 1312
actioN 1090
Yoon 993
Jaedong 926
Soma 558
[ Show more ]
PianO 330
firebathero 282
Shuttle 274
Leta 259
sSak 212
Zeus 206
Light 204
Mini 202
Hyun 149
Soulkey 94
Snow 81
Pusan 78
ToSsGirL 77
Mong 73
Aegong 68
Killer 61
Sharp 42
Rush 42
hero 35
Movie 31
Free 27
Icarus 23
sorry 22
Noble 21
sas.Sziky 17
Terrorterran 5
soO 1
Dota 2
XcaliburYe1233
qojqva112
League of Legends
JimRising 460
Counter-Strike
ScreaM1804
oskar73
Other Games
summit1g11294
singsing1955
B2W.Neo668
DeMusliM324
crisheroes234
Fuzer 140
Mew2King76
Liquid`LucifroN56
QueenE33
Organizations
Counter-Strike
PGL10469
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos2171
• Nemesis748
Upcoming Events
CranKy Ducklings
21h 44m
Safe House 2
1d 4h
Sparkling Tuna Cup
1d 21h
Safe House 2
2 days
Tenacious Turtle Tussle
5 days
The PondCast
5 days
Liquipedia Results

Completed

Acropolis #4 - TS2
WardiTV TLMC #15
HCC Europe

Ongoing

BSL 21 Points
ASL Season 20
CSL 2025 AUTUMN (S18)
C-Race Season 1
IPSL Winter 2025-26
EC S1
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual

Upcoming

SC4ALL: Brood War
BSL Season 21
BSL 21 Team A
RSL Offline Finals
RSL Revival: Season 3
Stellar Fest
SC4ALL: StarCraft II
CranK Gathers Season 2: SC II Pro Teams
eXTREMESLAND 2025
ESL Impact League Season 8
SL Budapest Major 2025
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.