• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 09:08
CEST 15:08
KST 22:08
  • 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
Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12TL.net Map Contest #22 - Voting & Ladder Map Selection7Code S Season 2 (2026) - RO8 Preview7[ASL21] Finals Preview: Two Legacies21
Community News
Weekly Cups (June 8-14): Clem and Solar double, PTR tested0RSL: S6 Finals played at BlizzCon 202611Douyu Cup 2026: $20,000 Legends Event (June 26-28)10[BSL22] Non-Korean Championship from 13 to 28 June4Weekly Cups (May 25-31): Clem doubles, 2v2 circuit heads toward finale0
StarCraft 2
General
Daily SC2 Player Grid - feedback wanted TL Poll: How do you feel about the 5.0.16 PTR balance changes? Code S Season 2 (2026) - RO8 Preview Updates to The Core/Core Lite for v5.0.16? RSL: S6 Finals played at BlizzCon 2026
Tourneys
GSL CK #4 20-21th June Crank Gathers Season 4: BW vs SC2 Team League Douyu Cup 2026: $20,000 Legends Event (June 26-28) Maestros of The Game 2 announcement and schedule ! Sparkling Tuna Cup - Weekly Open Tournament
Strategy
[G] Having the right mentality to improve
Custom Maps
Work In Progress Melee Maps [D]RTS in all its shapes and glory <3
External Content
Mutation # 530 One For All The PondCast: SC2 News & Results Mutation # 529 Opportunities Unleashed Mutation # 528 Infection Detected
Brood War
General
BW General Discussion vespene.gg — BW replays in browser Where is EffOrt? BGH Auto Balance -> http://bghmmr.eu/ Quality of life changes in BW that you will like ?
Tourneys
[Megathread] Daily Proleagues [ASL21] Grand Finals [BSL22] Grand Finals - Sunday 21:00 CEST Escore Tournament StarCraft Season 2
Strategy
Relatively freeroll strategies Creating a full chart of Zerg builds Why doesn't anyone use restoration? Any training maps people recommend?
Other Games
General Games
Stormgate/Frost Giant Megathread Nintendo Switch Thread ZeroSpace Megathread Beyond All Reason Total War: Warhammer 40K
Dota 2
Looking for a Dota Mentor 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
TL Mafia
Vanilla Mini Mafia
Community
General
US Politics Mega-thread The Games Industry And ATVI UK Politics Mega-thread Russo-Ukrainian War Thread [H]Internet/Gaming Cafe Tips and Tricks
Fan Clubs
The HerO Fan Club! The herO Fan Club!
Media & Entertainment
Movie Discussion! [Req][Books] Good Fantasy/SciFi books [TV/BOOK] *SPOILERS* Game of Thrones Discussion [Manga] One Piece
Sports
2024 - 2026 Football Thread TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion Cricket [SPORT] NBA General Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Facing Challenges in Mobile App Development
TL Community
The Automated Ban List
Blogs
Does Workplace Frustration D…
TrAiDoS
An Exploration of th…
waywardstrategy
I'm an arrogant trash talke…
FlaShFTW
Gauntlet SC2: A Retrospectiv…
Ctone23
Why RTS gamers make better f…
gosubay
Customize Sidebar...

Website Feedback

Closed Threads



Active: 8437 users

Riddle me this, Riddle me that: - Page 11

Forum Index > General Forum
Post a Reply
Prev 1 9 10 11 All
Centric
Profile Blog Joined March 2008
United States1989 Posts
February 25 2009 23:33 GMT
#201
On February 26 2009 08:10 antiq wrote:
May I join in? This is not a riddle per se, but a mathematical problem my bro had to cope with in some obscure programming class.

Say .. Jimmy walks into the classroom and sees a set of numbers on the blackboard:

1,2,3,4,5, .. etc .. N

Now, he is a bit goofy, think Rainman, so he starts to play with the numbers:

He picks a number, say R - then adds together the first R numbers from the set in his head, deletes them and writes their sum at the end of the whole set (after the initial N).

(If there are no more R numbers in the set, he just takes all that are left)

And he decides to do this K-times .. so, what is the last number in the set now (the K-th number which he writes)?

If you have N=5 (that means 1,2,3,4,5); R=2, K=3, it's obvious, you get

1,2,3,4,5
3,4,5,3
5,3,7
7,8 -> so the answer is 8

But say you have a range of numbers 1-1^9 (1-billion) for N,R and K ...
How would you get the answer if the input was N=92312386, R=432765 and K=87397?

Write a computer program that does the whole procedure fast, yes.. but no, not really the hard way you would expect. The thing is, the numbers get too huge even for normal computers - and the limit for this program was set at 64MB used and 1sec time anyway.

Any mathematically gifted among the TL-netters? Btw, I don't know the answer and the number doesn't interest me that much, the interesting thing is the algorithm, how did you get the result (I don't know the algorithm either :3)

I believe Sean Plott (Day[9]) is a math man.
Super serious.
datscilly
Profile Blog Joined November 2007
United States529 Posts
February 26 2009 00:19 GMT
#202
@antiq
Imagine that the numbers from 1 to N are written in a circle instead of in a line. Instead of summing, just circle the numbers to be summed. The circled numbered are to be treated as one number in future circlings (summings). This shows that any numbers in a circle are consecutive numbers. All you need to keep track of are the bottom and top numbers in the set to be summed.

Example:
Suppose N=10, R=3, K=4. (Write out 1-10 in a circle.) First, circle 1-3. Then 4-6, and 7-9. Now, since 1-3 and 4-6 are already circled, circle 10, 1-3, and 4-6. The smaller circles around 1-3 and 4-6 can be removed, resulting in one big circle around 10 through 6. Continuing like this, we see that the last group to be summed is always a set of consecutive numbers around the circle.
Prev 1 9 10 11 All
Please log in or register to reply.
Live Events Refresh
Kung Fu Cup
11:00
#12
IntoTheiNu 901
RotterdaM562
WardiTV544
TKL 289
Rex152
Ryung 141
SteadfastSC133
CosmosSc2 51
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
RotterdaM 594
TKL 304
Rex 155
SteadfastSC 141
Ryung 141
Railgan 56
CosmosSc2 43
MindelVK 17
StarCraft: Brood War
Sea 4236
Shuttle 1685
Horang2 1287
EffOrt 688
Soulkey 675
Mini 598
BeSt 447
Light 288
Snow 240
hero 193
[ Show more ]
ggaemo 186
Mong 169
Last 159
Zeus 102
Leta 95
Hyuk 82
Sharp 68
ToSsGirL 52
Movie 47
Liquid`Ret 46
JYJ 46
[sc1f]eonzerg 33
Aegong 28
sorry 22
Free 21
NaDa 20
Backho 20
soO 15
Sacsri 15
scan(afreeca) 15
zelot 14
GoRush 14
Noble 13
ajuk12(nOOB) 11
IntoTheRainbow 10
Terrorterran 8
Icarus 5
Dota 2
Dendi1492
XcaliburYe268
LuMiX1
Counter-Strike
olofmeister2177
byalli242
kRYSTAL_29
Super Smash Bros
Mew2King114
Other Games
B2W.Neo832
Lowko692
hiko555
crisheroes306
Pyrionflax264
DeMusliM243
XaKoH 220
Sick194
QueenE59
mouzStarbuck40
Organizations
Dota 2
PGL Dota 2 - Secondary Stream6732
StarCraft: Brood War
lovetv 15
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
[ Show 12 non-featured ]
StarCraft 2
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Jankos1884
• TFBlade296
Upcoming Events
The PondCast
20h 52m
WardiTV Spring Champion…
21h 52m
OSC
23h 52m
OSC
1d 10h
CranKy Ducklings
1d 20h
WardiTV Spring Champion…
1d 21h
WardiTV Spring Champion…
2 days
GSL
2 days
Maru vs ShoWTimE
Classic vs Reynor
herO vs Lambo
Solar vs Clem
BSL22 NKC (BSL vs China)
3 days
XuanXuan vs Jaystar
Mihu vs Messiah
eOnzErG vs Dewalt
Bonyth vs Jaystar
TerrOr vs Messiah
XuanXuan vs Mihu
eOnzErG vs Jaystar
Replay Cast
3 days
[ Show More ]
WardiTV Spring Champion…
3 days
GSL
3 days
Patches Events
4 days
BSL22 NKC (BSL vs China)
4 days
Dewalt vs Messiah
Bonyth vs Mihu
TerrOr vs XuanXuan
eOnzErG vs Messiah
Jaystar vs Mihu
Dewalt vs XuanXuan
Bonyth vs TerrOr
Replay Cast
4 days
WardiTV Weekly
4 days
Sparkling Tuna Cup
5 days
Liquipedia Results

Completed

Proleague 2026-06-16
uThermal 2v2 2026 Main Event
Heroes Pulsing #1

Ongoing

IPSL Spring 2026
KCM Race Survival 2026 Season 2
Acropolis #4
CSCL: Masked Kings S4
YSL S3
BSL 22 Non-Korean Championship
SCTL 2026 Spring
Maestros of the Game 2
WardiTV Spring 2026
Murky Cup 2026
Heroes Pulsing #2
IEM Cologne Major 2026
Stake Ranked Episode 2
CS Asia Championships 2026
Asian Champions League 2026
IEM Atlanta 2026
PGL Astana 2026
BLAST Rivals Spring 2026
IEM Rio 2026
PGL Bucharest 2026
Stake Ranked Episode 1

Upcoming

CSL 2026 Summer (S21)
CSLAN 4
Blizzard Classic Cup 2026
Kung Fu Cup 2026 Grand Finals
RSL Revival: Season 6
CranK Gathers Season 4: BW vs SC2 Team League
HSC XXIX
Douyu Cup 2026
BCC 2026
Heroes Pulsing #3
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
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 © 2026 TLnet. All Rights Reserved.