• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 17:46
CEST 23:46
KST 06:46
  • 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
BGE Stara Zagora 2025: Info & Preview26Code S RO12 Preview: GuMiho, Bunny, SHIN, ByuN3The Memories We Share - Facing the Final(?) GSL46Code S RO12 Preview: Cure, Zoun, Solar, Creator4[ASL19] Finals Preview: Daunting Task30
Community News
[BSL20] ProLeague: Bracket Stage & Dates7GSL Ro4 and Finals moved to Sunday June 15th12Weekly Cups (May 27-June 1): ByuN goes back-to-back0EWC 2025 Regional Qualifier Results26Code S RO12 Results + RO8 Groups (2025 Season 2)3
StarCraft 2
General
The SCII GOAT: A statistical Evaluation BGE Stara Zagora 2025: Info & Preview Magnus Carlsen and Fabi review Clem's chess game. Jim claims he and Firefly were involved in match-fixing GSL Ro4 and Finals moved to Sunday June 15th
Tourneys
Bellum Gens Elite: Stara Zagora 2025 Master Swan Open (Global Bronze-Master 2) $5,100+ SEL Season 2 Championship (SC: Evo) SOOPer7s Showmatches 2025 Cheeseadelphia 2025 - Open Bracket LAN!
Strategy
[G] Darkgrid Layout Simple Questions Simple Answers [G] PvT Cheese: 13 Gate Proxy Robo
Custom Maps
[UMS] Zillion Zerglings
External Content
Mutation # 476 Charnel House Mutation # 475 Hard Target Mutation # 474 Futile Resistance Mutation # 473 Cold is the Void
Brood War
General
Will foreigners ever be able to challenge Koreans? BGH auto balance -> http://bghmmr.eu/ BW General Discussion I made an ASL quiz [BSL20] ProLeague: Bracket Stage & Dates
Tourneys
[ASL19] Grand Finals [Megathread] Daily Proleagues [BSL20] ProLeague Bracket Stage - Day 2 [BSL20] ProLeague Bracket Stage - Day 1
Strategy
I am doing this better than progamers do. [G] How to get started on ladder as a new Z player
Other Games
General Games
What do you want from future RTS games? Stormgate/Frost Giant Megathread Path of Exile Nintendo Switch Thread Mechabellum
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
LiquidLegends to reintegrate into TL.net
Heroes of the Storm
Heroes of the Storm 2.0 Simple Questions, Simple Answers
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
US Politics Mega-thread Things Aren’t Peaceful in Palestine Russo-Ukrainian War Thread Vape Nation Thread European Politico-economics QA Mega-thread
Fan Clubs
Maru Fan Club Serral Fan Club
Media & Entertainment
Korean Music Discussion [Manga] One Piece
Sports
2024 - 2025 Football Thread Formula 1 Discussion NHL Playoffs 2024
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Cleaning My Mechanical Keyboard
TL Community
The Automated Ban List
Blogs
Cognitive styles x game perf…
TrAiDoS
StarCraft improvement
iopq
Heero Yuy & the Tax…
KrillinFromwales
I was completely wrong ab…
jameswatts
Need Your Help/Advice
Glider
Trip to the Zoo
micronesia
Poker
Nebuchad
Customize Sidebar...

Website Feedback

Closed Threads



Active: 9015 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
BSL: ProLeague
18:00
Bracket Stage: Day 1
StRyKeR vs MadiNho
Cross vs UltrA
TT1 vs JDConan
Bonyth vs Sziky
ZZZero.O340
Liquipedia
CSO Contender
17:00
#42
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
ROOTCatZ 156
BRAT_OK 121
StarCraft: Brood War
Britney 18534
ZZZero.O 340
Dewaltoss 131
soO 44
Terrorterran 14
Dota 2
Pyrionflax166
League of Legends
Grubby2734
Dendi1602
Counter-Strike
fl0m7687
rGuardiaN134
Stewie2K85
Super Smash Bros
C9.Mang05353
Chillindude35
Heroes of the Storm
Liquid`Hasu582
Khaldor195
Other Games
tarik_tv18654
summit1g6992
FrodaN2432
B2W.Neo753
KnowMe45
Organizations
Dota 2
PGL Dota 2 - Secondary Stream4134
Other Games
gamesdonequick727
BasetradeTV106
StarCraft 2
angryscii 40
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 20 non-featured ]
StarCraft 2
• Hupsaiya 73
• musti20045 28
• Adnapsc2 27
• RyuSc2 19
• tFFMrPink 6
• IndyKCrew
• Migwel
• AfreecaTV YouTube
• sooper7s
• intothetv
• Kozan
• LaughNgamezSOOP
StarCraft: Brood War
• STPLYoutube
• ZZZeroYoutube
• BSLYoutube
Dota 2
• masondota21392
• Ler145
League of Legends
• Doublelift2225
Counter-Strike
• Shiphtur258
Other Games
• imaqtpie1477
Upcoming Events
Replay Cast
2h 14m
SOOP Global
5h 14m
Creator vs Rogue
Cure vs Classic
SOOP
11h 14m
Classic vs GuMiho
Sparkling Tuna Cup
12h 14m
AllThingsProtoss
13h 14m
Fire Grow Cup
17h 14m
BSL: ProLeague
20h 14m
HBO vs Doodle
spx vs Tech
DragOn vs Hawk
Dewalt vs TerrOr
Replay Cast
1d 2h
Replay Cast
2 days
Replay Cast
2 days
[ Show More ]
WardiTV Invitational
2 days
WardiTV Invitational
2 days
GSL Code S
3 days
Rogue vs GuMiho
Maru vs Solar
Replay Cast
4 days
GSL Code S
4 days
herO vs TBD
Classic vs TBD
The PondCast
4 days
Replay Cast
5 days
GSL Code S
5 days
WardiTV Invitational
5 days
Korean StarCraft League
6 days
CranKy Ducklings
6 days
WardiTV Invitational
6 days
Cheesadelphia
6 days
Cheesadelphia
6 days
Liquipedia Results

Completed

CSL Season 17: Qualifier 1
DreamHack Dallas 2025
Heroes 10 EU

Ongoing

JPL Season 2
BSL 2v2 Season 3
BSL Season 20
KCM Race Survival 2025 Season 2
NPSL S3
Rose Open S1
CSL Season 17: Qualifier 2
2025 GSL S2
BLAST.tv Austin Major 2025
ESL Impact League Season 7
IEM Dallas 2025
PGL Astana 2025
Asian Champions League '25
ECL Season 49: Europe
BLAST Rivals Spring 2025
MESA Nomadic Masters
CCT Season 2 Global Finals
IEM Melbourne 2025
YaLLa Compass Qatar 2025
PGL Bucharest 2025
BLAST Open Spring 2025

Upcoming

CSL 17: 2025 SUMMER
Copa Latinoamericana 4
CSLPRO Last Chance 2025
CSLPRO Chat StarLAN 3
K-Championship
SEL Season 2 Championship
Esports World Cup 2025
HSC XXVII
Championship of Russia 2025
Murky Cup #2
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
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.