• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 20:29
CET 02:29
KST 10:29
  • 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
RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12Intel X Team Liquid Seoul event: Showmatches and Meet the Pros10
Community News
Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15[BSL21] Ro.16 Group Stage (C->B->A->D)4Weekly Cups (Nov 17-23): Solar, MaxPax, Clem win3RSL Season 3: RO16 results & RO8 bracket13
StarCraft 2
General
Chinese SC2 server to reopen; live all-star event in Hangzhou Maestros of the Game: Live Finals Preview (RO4) BGE Stara Zagora 2026 announced Weekly Cups (Nov 24-30): MaxPax, Clem, herO win SC2 Proleague Discontinued; SKT, KT, SGK, CJ disband
Tourneys
RSL Offline Finals Info - Dec 13 and 14! Sparkling Tuna Cup - Weekly Open Tournament StarCraft Evolution League (SC Evo Biweekly) Sea Duckling Open (Global, Bronze-Diamond) $5,000+ WardiTV 2025 Championship
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress Mutation # 500 Fright night Mutation # 499 Chilling Adaptation
Brood War
General
Foreign Brood War BGH Auto Balance -> http://bghmmr.eu/ Data analysis on 70 million replays BW General Discussion MBCGame Torrents
Tourneys
Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] RO16 Group D - Sunday 21:00 CET [BSL21] RO16 Group A - Saturday 21:00 CET
Strategy
Current Meta Game Theory for Starcraft How to stay on top of macro? PvZ map balance
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread Path of Exile ZeroSpace Megathread The Perfect Game
Dota 2
Official 'what is Dota anymore' discussion
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
Mafia Game Mode Feedback/Ideas TL Mafia Community Thread
Community
General
US Politics Mega-thread European Politico-economics QA Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread The Big Programming Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Where to ask questions and add stream? The Automated Ban List
Blogs
I decided to write a webnov…
DjKniteX
Physical Exertion During Gam…
TrAiDoS
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1136 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
OSC
22:00
Masters Cup #150: Playoffs
Solar vs Creator
ByuN vs Gerald
Percival vs Babymarine
Moja vs Krystianer
EnDerr vs ForJumy
sebesdes vs Nicoract
davetesta71
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
PiGStarcraft423
White-Ra 252
ROOTCatZ 41
StarCraft: Brood War
NaDa 55
Dota 2
canceldota148
League of Legends
C9.Mang0432
Counter-Strike
minikerr44
Super Smash Bros
amsayoshi160
Heroes of the Storm
Khaldor156
Other Games
summit1g9060
tarik_tv8758
shahzam357
XaKoH 151
ViBE93
Chillindude66
Trikslyr43
Organizations
Other Games
gamesdonequick726
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 15 non-featured ]
StarCraft 2
• Hupsaiya 29
• RyuSc2 28
• HeavenSC 20
• Freeedom9
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• Ler69
Upcoming Events
Sparkling Tuna Cup
8h 31m
WardiTV 2025
10h 31m
OSC
13h 31m
IPSL
15h 31m
Bonyth vs KameZerg
BSL 21
18h 31m
Bonyth vs StRyKeR
Tarson vs Dandy
Replay Cast
1d 7h
Wardi Open
1d 10h
StarCraft2.fi
1d 14h
Monday Night Weeklies
1d 15h
Replay Cast
1d 22h
[ Show More ]
WardiTV 2025
2 days
StarCraft2.fi
2 days
PiGosaur Monday
2 days
StarCraft2.fi
3 days
Tenacious Turtle Tussle
3 days
The PondCast
4 days
WardiTV 2025
4 days
StarCraft2.fi
4 days
WardiTV 2025
5 days
StarCraft2.fi
6 days
RSL Revival
6 days
IPSL
6 days
Sziky vs JDConan
Liquipedia Results

Completed

Proleague 2025-12-04
RSL Revival: Season 3
Light HT

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
CSCL: Masked Kings S3
Slon Tour Season 2
Acropolis #4 - TS3
WardiTV 2025
META Madness #9
Kuram Kup
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
RSL Offline Finals
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
eXTREMESLAND 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.