• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 07:25
CEST 13:25
KST 20:25
  • 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
Serral wins HomeStory Cup 2915Serral wins Maestros of the Game 243ByuL, and the Limitations of Standard Play3Team Liquid Map Contest #22: Results and Winners7Code S Season 2 (2026): RO4 and Finals Preview12
Community News
Weekly Cups (Aug 3-9): Protoss get shut out6RSL goes to London! 2026 Offline Finals Nov 21-2212Weekly Cups (July 27-Aug 2): SHIN's big week0SC4ALL II: Brood War - $2500 - Dec 5-69SC4ALL II announced - $10,000 prize pool, Dec 5-64
StarCraft 2
General
Weekly Cups (Aug 3-9): Protoss get shut out SC4ALL: II Talent Announcement! SC4ALL II: StarCraft 2 Player Announcement 5/8 Protoss AoE skill expression August World Ranking: Clem climbs to #2
Tourneys
2026 KungFu Cup Announcement PIG STY FESTIVAL 8.0! (13 - 23 August) Sparkling Tuna Cup - Weekly Open Tournament RSL goes to London! 2026 Offline Finals Nov 21-22 RSL Revival: Season 6 - Qualifiers and Main Event
Strategy
[G] Having the right mentality to improve
Custom Maps
Nexus Wars 2021 GUIDE [M] (2) Industrial Park
External Content
Mutation # 538 Media Blackout The PondCast: SC2 News & Results Mutation # 537 Hostile Territory Mutation # 536 Railroad Switch
Brood War
General
BW General Discussion Michaelbg appreciation thread ASL22 General Discussion How FlaSh Nearly Forfeited MSL Finals being late BGH Auto Balance -> http://bghmmr.eu/
Tourneys
[Megathread] Daily Proleagues KCM Race Survival 2026 Season 3 2v2v2v2 Tournament Escore Tournament - Season 3
Strategy
Odyssey Mineral Stack Saturation Fighting Spirit mining rates Any training maps people recommend? Simple Questions, Simple Answers
Other Games
General Games
General RTS Discussion Thread Stormgate/Frost Giant Megathread Nintendo Switch Thread EVE Corporation Diablo 2 thread
Dota 2
Looking for a Dota Mentor Official 'what is Dota anymore' discussion
League of Legends
[TL LoL EUW IHs] Teemo shall perish TSM pausing esports and CLG Dead
Heroes of the Storm
Heroes of the Storm 2.0
Hearthstone
Deck construction bug
TL Mafia
TL Mafia Power Rank TL Mafia Community Thread NeO.D_StephenKing vs This Guy From 1 Million Dance
Community
General
US Politics Mega-thread The Letting Off Steam Thread Iain M Banks Says He Has Cancer And Months To Live Russo-Ukrainian War Thread European Politico-economics QA Mega-thread
Fan Clubs
MarineLorD Fan Club The ShoWTimE Fan Club The herO Fan Club!
Media & Entertainment
Movie Discussion! Anime Discussion Thread Series you have seen recently... [Req][Books] Good Fantasy/SciFi books
Sports
Football (Soccer) Thread NBA General Discussion TeamLiquid Health and Fitness Initiative For 2023 Formula 1 Discussion MLB/Baseball 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread Simple Questions Simple Answers FPS when play League Of Legend on laptop
TL Community
The Automated Ban List Northern Ireland Global Starcraft
Blogs
Are High-Level Gamers more A…
TrAiDoS
Cathedral Of CS And NY pizza a…
FuDDx
Please support my new stand…
Peanutsc
Hello guys!
LIN1s
ASL S22 English Commentary…
namkraft
Poker (part 2)
Nebuchad
Customize Sidebar...

Website Feedback

Closed Threads



Active: 4376 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
2026 Week 19
IntoTheiNu 305
WardiTV209
RotterdaM182
SteadfastSC49
LiquipediaDiscussion
Replay Cast
09:00
KungFu Cup 2026 Week 18
CranKy Ducklings95
LiquipediaDiscussion
PiGosaur Cup
00:00
#94
Liquipedia
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
Lowko317
RotterdaM 182
TKL 76
SteadfastSC 49
Rex 36
StarCraft: Brood War
Britney 22510
Shuttle 4033
Bisu 1159
firebathero 735
Soulkey 373
Mini 351
Hyuk 326
Rush 227
actioN 198
Larva 191
[ Show more ]
Light 179
EffOrt 172
Killer 140
PianO 133
Stork 133
Snow 120
Soma 114
Last 114
Sexy 112
Pusan 109
Barracks 74
hero 73
Hyun 65
ZerO 54
ToSsGirL 38
Hm[arnc] 27
Sharp 26
yabsab 21
JulyZerg 19
Terrorterran 19
NotJumperer 18
sSak 18
Shine 15
JYJ 15
Free 12
sorry 11
Dota 2
Dendi666
Fuzer 147
League of Legends
JimRising 306
Counter-Strike
fl0m4551
olofmeister881
shoxiejesuss625
byalli520
Super Smash Bros
Mew2King110
Other Games
B2W.Neo335
crisheroes220
DeMusliM170
Sick151
ToD127
QueenE41
Liquid`LucifroN30
ZerO(Twitch)7
Organizations
Other Games
gamesdonequick492
BasetradeTV46
StarCraft: Brood War
lovetv 14
[ Show 14 non-featured ]
StarCraft 2
• StrangeGG 69
• LUISG 19
• CranKy Ducklings SOOP7
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• Migwel
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota2321
League of Legends
• Jankos1092
Other Games
• WagamamaTV314
Upcoming Events
Replay Cast
12h 35m
The PondCast
22h 35m
OSC
1d 1h
Replay Cast
1d 12h
Escore
1d 22h
CranKy Ducklings
2 days
Sparkling Tuna Cup
3 days
OSC
4 days
Afreeca Starleague
4 days
Rush vs Hm
Bisu vs Shuttle
WardiTV Weekly
4 days
[ Show More ]
The Patches Monday
5 days
Afreeca Starleague
5 days
Sharp vs Shinee
Action vs Shine
PiGosaur Cup
6 days
Replay Cast
6 days
Afreeca Starleague
6 days
BeSt vs Paralyze
Jaedong vs Speed
Kung Fu Cup
6 days
Liquipedia Results

Completed

Proleague 2026-08-10
CranK Gathers Season 4: BW vs SC2 Team League
Eternal Conflict S2 Finale

Ongoing

KCM Race Survival 2026 Season 3
K-JUNGMAN
Acropolis #5
RSL Revival: Season 6
Esports World Cup 2026
Esports World Cup 2026: LCQ
BLAST Bounty Summer 2026
BLAST Bounty Summer Qual
Stake Ranked Episode 3
XSE Pro League 2026
IEM Cologne Major 2026
Stake Ranked Episode 2

Upcoming

Escore Tournament S3: W7
CSLAN 4
ASL Season 22
Escore Tournament S3: W8
Acropolis #5 - TRS
Blizzard Classic Cup 2026
Acropolis #5 - GSA
HSC XXX
SC4ALL II: StarCraft II
Kung Fu Cup 2026 Grand Finals
RSL Offline Finals
PiG Sty Festival 8.0
Big Dog Cup 2026 Div 1
META DYMY #4
PGL Masters Bucharest 2026
Thunderpick World Champ.
ESL Pro League Season 24
Stake Ranked Episode 4
Logitech G Connect 2026
SL StarSeries Fall 2026
FISSURE Playground #5
BLAST Open Fall 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.