Post Reply 
RPL Micro-Challenge: Christmas in July
07-17-2017, 02:26 PM
Post: #1
RPL Micro-Challenge: Christmas in July
Everybody knows the "12 Days of Christmas" Song (Partridge in a Pear Tree etc). How many gifts has my true love given to me altogether by the end of Day 3? Well, the sum of today's 6 gifts (3+2+1) plus yesterday's 3 gifts (2+1) plus the first day's 1 gift comes to 10 gifts in all. So the Total Gifts through Day 3 = TG(3) = 10.

What is the smallest possible (byte-count) User RPL program that calculates TG(x)?

To check your program, here are a few sample inputs and outputs:

TG(3)=10
TG(5)=35
TG(12)=364
TG(365)=8171255

N.B. This is called a micro-challenge instead of a mini-challenge because a REALLY SMALL solution exists. If it's obvious to you, please don't post it right away; let others try to find it first. "We only appreciate the answer if we struggle with the question." -- Ignatius O'Brien, O.P.

<0|ΙΈ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RPL Micro-Challenge: Christmas in July - Joe Horn - 07-17-2017 02:26 PM



User(s) browsing this thread: 1 Guest(s)