• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EST 01:15
CET 07:15
KST 15:15
  • 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
RSL Revival - 2025 Season Finals Preview8RSL Season 3 - Playoffs Preview0RSL Season 3 - RO16 Groups C & D Preview0RSL Season 3 - RO16 Groups A & B Preview2TL.net Map Contest #21: Winners12
Community News
ComeBackTV's documentary on Byun's Career !9Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win4Weekly Cups (Dec 1-7): Clem doubles, Solar gets over the hump1Weekly Cups (Nov 24-30): MaxPax, Clem, herO win2BGE Stara Zagora 2026 announced15
StarCraft 2
General
Micro Lags When Playing SC2? ComeBackTV's documentary on Byun's Career ! When will we find out if there are more tournament Weekly Cups (Dec 8-14): MaxPax, Clem, Cure win RSL Revival - 2025 Season Finals Preview
Tourneys
$100 Prize Pool - Winter Warp Gate Masters Showdow $5,000+ WardiTV 2025 Championship Winter Warp Gate Amateur Showdown #1 Sparkling Tuna Cup - Weekly Open Tournament RSL Offline Finals Info - Dec 13 and 14!
Strategy
Custom Maps
Map Editor closed ?
External Content
Mutation # 504 Retribution Mutation # 503 Fowl Play Mutation # 502 Negative Reinforcement Mutation # 501 Price of Progress
Brood War
General
Klaucher discontinued / in-game color settings Anyone remember me from 2000s Bnet EAST server? BGH Auto Balance -> http://bghmmr.eu/ How Rain Became ProGamer in Just 3 Months FlaSh on: Biggest Problem With SnOw's Playstyle
Tourneys
[BSL21] LB QuarterFinals - Sunday 21:00 CET Small VOD Thread 2.0 [Megathread] Daily Proleagues [BSL21] WB SEMIFINALS - Saturday 21:00 CET
Strategy
Simple Questions, Simple Answers Game Theory for Starcraft Current Meta Fighting Spirit mining rates
Other Games
General Games
Stormgate/Frost Giant Megathread General RTS Discussion Thread Nintendo Switch Thread Mechabellum PC Games Sales Thread
Dota 2
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 Heroes of StarCraft mini-set
TL Mafia
Mafia Game Mode Feedback/Ideas Survivor II: The Amazon Sengoku Mafia TL Mafia Community Thread
Community
General
US Politics Mega-thread Russo-Ukrainian War Thread Things Aren’t Peaceful in Palestine The Games Industry And ATVI YouTube Thread
Fan Clubs
White-Ra Fan Club
Media & Entertainment
Anime Discussion Thread [Manga] One Piece Movie Discussion!
Sports
2024 - 2026 Football Thread Formula 1 Discussion
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread
TL Community
TL+ Announced Where to ask questions and add stream?
Blogs
The (Hidden) Drug Problem in…
TrAiDoS
I decided to write a webnov…
DjKniteX
James Bond movies ranking - pa…
Topin
Thanks for the RSL
Hildegard
Customize Sidebar...

Website Feedback

Closed Threads



Active: 1970 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 3h 45m
[ Submit Event ]
Live Streams
Refresh
StarCraft 2
WinterStarcraft651
Nina 117
StarCraft: Brood War
Shuttle 492
Leta 262
Mong 25
Noble 22
Sea 0
Dota 2
NeuroSwarm66
LuMiX1
League of Legends
JimRising 665
Heroes of the Storm
Khaldor154
Other Games
summit1g8557
Mew2King115
RuFF_SC2107
Models2
Organizations
Other Games
gamesdonequick720
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 12 non-featured ]
StarCraft 2
• Berry_CruncH233
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Other Games
• Scarra1780
Upcoming Events
Sparkling Tuna Cup
3h 45m
Ladder Legends
10h 45m
BSL 21
13h 45m
StRyKeR vs TBD
Bonyth vs TBD
Replay Cast
1d 2h
Wardi Open
1d 5h
Monday Night Weeklies
1d 10h
WardiTV Invitational
3 days
Replay Cast
4 days
WardiTV Invitational
4 days
ByuN vs Solar
Clem vs Classic
Cure vs herO
Reynor vs MaxPax
Replay Cast
5 days
Liquipedia Results

Completed

Acropolis #4 - TS3
RSL Offline Finals
Kuram Kup

Ongoing

C-Race Season 1
IPSL Winter 2025-26
KCM Race Survival 2025 Season 4
YSL S2
BSL Season 21
Slon Tour Season 2
CSL Season 19: Qualifier 1
WardiTV 2025
META Madness #9
eXTREMESLAND 2025
SL Budapest Major 2025
ESL Impact League Season 8
BLAST Rivals Fall 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
CS Asia Championships 2025
ESL Pro League S22

Upcoming

CSL Season 19: Qualifier 2
CSL 2025 WINTER (S19)
BSL 21 Non-Korean Championship
Acropolis #4
IPSL Spring 2026
Bellum Gens Elite Stara Zagora 2026
HSC XXVIII
Big Gabe Cup #3
OSC Championship Season 13
Nations Cup 2026
ESL Pro League Season 23
PGL Cluj-Napoca 2026
IEM Kraków 2026
BLAST Bounty Winter 2026
BLAST Bounty Winter Qual
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.