• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 05:05
CEST 11:05
KST 18:05
  • 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
[ASL21] Ro24 Preview Pt2: News Flash10[ASL21] Ro24 Preview Pt1: New Chaos0Team Liquid Map Contest #22 - Presented by Monster Energy18ByuL: The Forgotten Master of ZvT30Behind the Blue - Team Liquid History Book20
Community News
Weekly Cups (March 23-29): herO takes triple6Aligulac acquired by REPLAYMAN.com/Stego Research8Weekly Cups (March 16-22): herO doubles, Cure surprises3Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool51Weekly Cups (March 9-15): herO, Clem, ByuN win4
StarCraft 2
General
Rongyi Cup S3 - Preview & Info Team Liquid Map Contest #22 - Presented by Monster Energy Blizzard Classic Cup @ BlizzCon 2026 - $100k prize pool What mix of new & old maps do you want in the next ladder pool? (SC2) Aligulac acquired by REPLAYMAN.com/Stego Research
Tourneys
RSL Season 4 announced for March-April Sparkling Tuna Cup - Weekly Open Tournament StarCraft Evolution League (SC Evo Biweekly) WardiTV Mondays World University TeamLeague (500$+) | Signups Open
Strategy
Custom Maps
[M] (2) Frigid Storage Publishing has been re-enabled! [Feb 24th 2026]
External Content
The PondCast: SC2 News & Results Mutation # 520 Moving Fees Mutation # 519 Inner Power Mutation # 518 Radiation Zone
Brood War
General
Pros React To: JaeDong vs Queen ASL21 General Discussion so ive been playing broodwar for a week straight. BSL 22 Map Contest — Submissions OPEN to March 10 Klaucher discontinued / in-game color settings
Tourneys
[Megathread] Daily Proleagues [ASL21] Ro24 Group E [ASL21] Ro24 Group F Azhi's Colosseum - Foreign KCM
Strategy
What's the deal with APM & what's its true value Fighting Spirit mining rates Simple Questions, Simple Answers
Other Games
General Games
Stormgate/Frost Giant Megathread Starcraft Tabletop Miniature Game Nintendo Switch Thread General RTS Discussion Thread Darkest Dungeon
Dota 2
The Story of Wings Gaming Official 'what is Dota anymore' discussion
League of Legends
G2 just beat GenG in First stand
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 Five o'clock TL Mafia
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread The Chess Thread NASA and the Private Sector Things Aren’t Peaceful in Palestine
Fan Clubs
The IdrA Fan Club
Media & Entertainment
[Manga] One Piece [Req][Books] Good Fantasy/SciFi books Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion Cricket [SPORT] Tokyo Olympics 2021 Thread General nutrition recommendations
World Cup 2022
Tech Support
[G] How to Block Livestream Ads
TL Community
The Automated Ban List
Blogs
Broowar part 2
qwaykee
China Uses Video Games to Sh…
TrAiDoS
Funny Nicknames
LUCKY_NOOB
Iranian anarchists: organize…
XenOsky
FS++
Kraekkling
ASL S21 English Commentary…
namkraft
Electronics
mantequilla
Customize Sidebar...

Website Feedback

Closed Threads



Active: 13644 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
Next event in 55m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
SortOf 130
Codebar 28
StarCraft: Brood War
910 1828
Hyuk 705
Pusan 222
Larva 195
ggaemo 131
Killer 102
Nal_rA 75
ToSsGirL 65
Shinee 23
Bale 13
[ Show more ]
Hm[arnc] 11
NaDa 7
ajuk12(nOOB) 3
Terrorterran 1
Dota 2
XcaliburYe433
League of Legends
JimRising 521
Counter-Strike
shoxiejesuss839
Heroes of the Storm
Khaldor168
Other Games
summit1g13517
ceh9717
crisheroes173
Sick26
Organizations
Counter-Strike
PGL7428
Other Games
BasetradeTV305
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• LUISG 42
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
League of Legends
• Stunt492
Upcoming Events
Afreeca Starleague
55m
Wardi Open
1h 55m
Replay Cast
14h 55m
Sparkling Tuna Cup
1d
PiGosaur Cup
1d 14h
Kung Fu Cup
2 days
The PondCast
3 days
Replay Cast
3 days
Replay Cast
4 days
CranKy Ducklings
5 days
[ Show More ]
BSL
5 days
Replay Cast
5 days
Sparkling Tuna Cup
6 days
BSL
6 days
Replay Cast
6 days
Liquipedia Results

Completed

CSL Elite League 2026
RSL Revival: Season 4
NationLESS Cup

Ongoing

BSL Season 22
ASL Season 21
CSL Season 20: Qualifier 2
CSL 2026 SPRING (S20)
StarCraft2 Community Team League 2026 Spring
Nations Cup 2026
PGL Bucharest 2026
Stake Ranked Episode 1
BLAST Open Spring 2026
ESL Pro League S23 Finals
ESL Pro League S23 Stage 1&2
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026

Upcoming

Escore Tournament S2: W2
IPSL Spring 2026
Escore Tournament S2: W3
Acropolis #4
BSL 22 Non-Korean Championship
CSLAN 4
Kung Fu Cup 2026 Grand Finals
HSC XXIX
uThermal 2v2 2026 Main Event
RSL Revival: Season 5
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
CCT Season 3 Global Finals
IEM Rio 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.