• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 07:53
CEST 13:53
KST 20:53
  • 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
[ASL22] Ro4 Preview: Mirror Mirror6[ASL22] Ro8 Preview: Within Reach5[ASL22] Ro8 Preview: In A Tizzy11[ASL22] Ro16 Preview: Holy Diver5[ASL22] Ro16 Preview: Rough Waters10
Community News
Weekly Cups (October 5-11): Farewell to 5.0.160Rollback Netcode in Brood War845.0.17 Patch Notes - October 7, 202622Weekly Cups Results (Sep 28-Oct 4)0SC4ALL: II SC2 Complete Invited Player Lineup10
StarCraft 2
General
StarCraft open world shooter announced at BlizzCon Weekly Cups (October 5-11): Farewell to 5.0.16 5.0.17 Patch Notes - October 7, 2026 ESL Pro Tour for SC2 discontinued [Old] StarCraft 3 Reportedly in Development
Tourneys
Stellar Fest TWO the Moon (Dec 16-20) ISSL (IntoTheTV x SOOP SC2 League): Premier RSL 2026 Offline Finals LCQ Sign-Ups $3,500 WardiTV Not-Summer Championship ScienceCraft (October 24-25) - Live Event
Strategy
[H] ZvP Mid-Late Game: Stalkers Collossi HT
Custom Maps
[M] (2) Sweltering Sands [M] (2) Frigid Storage
External Content
The PondCast: SC2 News & Results Mutation # 547 Temple Of Terror Mutation # 546 Catch the Train Mutation # 545 And Drops and Rifts
Brood War
General
Sagi.gg Launcher Released BSL23 Confirmations Starts on New BSL Portal ASL22 General Discussion Visiting korea this week BW General Discussion
Tourneys
ASL 22 Finals [Megathread] Daily Proleagues [ASL22] Semifinal A [ASL22] Semifinal B
Strategy
Simple Questions, Simple Answers Cliff Jump Revisited (1 in a 1000 strategy) Replay Review Process - What do you do?
Other Games
General Games
Nintendo Switch Thread Stormgate/Frost Giant Megathread General RTS Discussion Thread Warcraft III: The Frozen Throne Total Annihilation Zero
Dota 2
Dota 2 Champions League Season 3 Begins April 25!
League of Legends
[TL LoL EUW IHs] Teemo shall perish
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine Canadian Politics Mega-thread Artificial Intelligence Thread
Fan Clubs
Serral Fan Club
Media & Entertainment
[Manga] One Piece Movie Discussion! Diablo Animated Series on Netflix
Sports
Football (Soccer) Thread TeamLiquid Health and Fitness Initiative For 2023 MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
Recent Gifted Posts
Blogs
The Link Between Gaming and …
TrAiDoS
[ASL22] Ro4 Day1 Ticket Giv…
bITt.mAN
38 yo Retired SWE loo…
PurE)Rabbit-SF
Can Bots Beat Pros?? Starcr…
namkraft
[meme] I finally understa…
LUCKY_NOOB
Customize Sidebar...

Website Feedback

Closed Threads



Active: 12321 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
WardiTV Weekly
20:00
WardiTV Mondays #108
IntoTheiNu 582
WardiTV357
OGKoka 203
Rex84
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
OGKoka 203
Rex 84
Codebar 12
StarCraft: Brood War
Britney 37685
Rain 2548
Bisu 1636
Horang2 775
Jaedong 682
Stork 420
Hyuk 328
Mini 268
EffOrt 202
Zeus 189
[ Show more ]
Rush 141
Light 139
Snow 122
Sea.KH 82
Dewaltoss 79
Yoon 77
Mong 75
hero 64
Pusan 59
Hyun 52
Shinee 38
PianO 27
Noble 25
Sharp 22
sSak 19
sorry 17
Sacsri 15
HiyA 15
JYJ 11
scan(afreeca) 10
ajuk12(nOOB) 8
Dota 2
Gorgc1601
Dendi885
syndereN235
League of Legends
Reynor100
Counter-Strike
olofmeister1413
markeloff52
Super Smash Bros
Mew2King87
Other Games
B2W.Neo507
crisheroes389
Pyrionflax198
Hui .146
DeMusliM127
Organizations
Other Games
BasetradeTV237
StarCraft: Brood War
UltimateBattle 58
lovetv 9
[ Show 12 non-featured ]
StarCraft 2
• StrangeGG 69
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• iopq 10
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• WagamamaTV683
League of Legends
• Jankos1927
Upcoming Events
PiGosaur Cup
12h 7m
Kung Fu Cup
23h 7m
The PondCast
1d 22h
Online Event
2 days
Korean StarCraft League
3 days
Afreeca Starleague
3 days
Rush vs Soulkey
CranKy Ducklings
3 days
BSL Open Qualifier
4 days
Sparkling Tuna Cup
4 days
IPSL
5 days
[ Show More ]
BSL Open Qualifier
5 days
WardiTV Weekly
5 days
IntoTheTV X SOOP
6 days
Liquipedia Results

Completed

Proleague 2026-10-12
Blizzard Classic Cup 2026
Copium Cup

Ongoing

ASL Season 22
Super Anchor Qualifying S3
Acropolis #5
HCC Season 3
ESL Pro League Season 24
Stake Ranked Episode 4
1win Private Club #1
Logitech G Play Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #3
BLAST Open Fall 2026
Esports World Cup 2026
BLAST Bounty Summer 2026

Upcoming

Acropolis #5 - GSC
BSL Season 23
SC4ALL II: Brood War
BSL 23: Non-Korean Championship
HSC XXX
Stellar Fest 2: Lunar Cup
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
eXTREMESLAND 2026
PGL Major Singapore 2026
Stake Ranked Episode 6
BLAST Rivals Fall 2026
IEM Beijing 2026
Stake Ranked Episode 5
PGL Masters Bucharest 2026
1win Private Club #2
Thunderpick World Champ. '26
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.