You can help CodeWalrus stay online by donating here.

## [ENDED] Code Golf - The Reboot #5

Started by JWinslow23, June 29, 2015, 07:50:18 PM

0 Members and 1 Guest are viewing this topic.

#### JWinslow23

Everybody back off, I'm taking back this contest

Hello, Omnimaga/CodeWalrus/Cemetech/my girlfriend/whoever is seeing this right now, and welcome to the fifth installment of...
Code Golf: The Reboot

As you can see, I'm neither @pimathbrainiac NOR @c4ooo , NOT EVEN @Juju , but I am the original @JWinslow23, the one who came up with this silly idea in the first place almost a year ago. However, don't expect me to host next time, or basically for the next few competitions. How it works is, there's this cycle of hosts that will successively host this competition, starting with pimath. Somewhere in that loop, there's yours-truly, with a challenge on deck to give you. This is that.

Don't know what code golf is? Check out this contest thread OR this really old contest thread for an explanation. Don't know what code is? Then you will not understand this website in general

Challenge 5

Problem

You, a person with a lisp, go to your car, and unlock it with the keys...but there's one problem...you don't have your keys with you.

"Oh no...I lotht my keith! Where'th my car keith?" you exclaim in nervousness. You know that you have more than one pair, but you can't for the life of you find any of them.

Suddenly, you remember...each of your keys had a number on it 10 or above, each of which you call a Keys Number, or "Keith Number". Now, these numbers have a special property:

For a number N with D digits, if you arranged the digits to make a Fibonacci-like sequence where the digits of N are the first few terms, and each number is the sum of the D preceding digits, it would have N somewhere in the sequence.

Examples:

14 is a Keith Number:`N = 14D = 21 + 4 = 54 + 5 = 95 + 9 = 14`197 is a Keith Number:`N = 197D = 31 + 9 + 7 = 179 + 7 + 17 = 337 + 17 + 33 = 5717 + 33 + 57 = 10733 + 57 + 107 = 197`1337 is NOT a Keith Number:`N = 1337D = 41 + 3 + 3 + 7 = 143 + 3 + 7 + 14 = 273 + 7 + 14 + 27 = 517 + 14 + 27 + 51 = 9914 + 27 + 51 + 99 = 19127 + 51 + 99 + 191 = 36851 + 99 + 191 + 368 = 70999 + 191 + 368 + 709 = 1367`Your mission: Help yourthelf find your keith!

Make a program that, given an integer input 10 or above, will tell you whether or not it is a Keith number.

Any output is permitted, but the output must be different for a truthy and falsy result, and the two different outputs must be specified to me so I know the difference. Finally, if the size of the program is exactly 1337 bytes...then that'd be kinda cool...

Scoring

All non-calc languages will be scored with this counter.
Assembly and compiled Axe programs will be scored on binary size (minus the header), and TI-BASIC will be scored on on-calc source size (again, minus the header).

Submission

PM me over on Omnimaga, Cemetech, or CodeWalrus, or tell my girlfriend and have her dictate the code to me. (If you take the latter option, I will give your code a -90% point bonus. I'm serious.)

Good luck! Remember, don't steal code from others; I want everyone to not fib and not cheat.

TI-BASIC

 Rank User Size Date 1 @lirtosiast 43 Jul 01 2015 02:25:25 pm 2 @PT_ 43 Jul 02 2015 01:24:20 pm 3 @mr womp womp 97 Jun 30 2015 09:13:00 pm

Lua

 Rank User Size Date 1 @Adriweb 152 Jun 30 2015 02:06:20 am

Javascript

 Rank User Size Date 1 @Adriweb 112 Jun 30 2015 02:06:20 am

Java

 Rank User Size Date 1 @c4ooo 190 Jul 01 2015 12:32:49 pm

Ruby

 Rank User Size Date 1 @Juju 150 Jun 30 2015 04:57:53 pm

Python

 Rank User Size Date 1 @Cumred_Snektron 83 Jul 01 2015 10:37:07 am

Language Ranking

 Rank Lang User Size Date 1 TI-BASIC @lirtosiast 43 Jul 01 2015 02:25:25 pm 2 Python @Cumred_Snektron 83 Jul 01 2015 10:37:07 am 3 Javascript @Adriweb 112 Jun 30 2015 02:06:20 am 4 Ruby @Juju 150 Jun 30 2015 04:57:53 pm 5 Lua @Adriweb 152 Jun 30 2015 02:06:20 am 6 Java @c4ooo 190 Jul 01 2015 12:32:49 pm

As I am having trouble with formatting, everyone's code has been put in a Pastebin paste here.
• Calculators owned: TI-84+, TI-84+ CSE, TI-84+ CE

#### Unicorn

Ummm Are the dates wrong? 1970? Is there some reason that is?
• Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
• Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???

#### JWinslow23

Quote from: Unicorn on June 29, 2015, 11:16:03 PM
Ummm Are the dates wrong? 1970? Is there some reason that is?
Nobody has submitted an entry yet. That's the Unix epoch
• Calculators owned: TI-84+, TI-84+ CSE, TI-84+ CE

#### Unicorn

#3
Ah... So I don't quit get it, As the result I have to make it display the whole tree, or just the final answer?
• Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
• Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???

#### JWinslow23

Quote from: Unicorn on June 30, 2015, 01:24:08 AM
Ah... So I don't quit get it, As the result I have to make it display the whole tree, or just the final answer?
As a result, you just need to tell me if the input N is a Keith number. The code tags are just so you know how such determination works. Output may be anything, but it must be different for true and false. And you must specify what means true or false.
• Calculators owned: TI-84+, TI-84+ CSE, TI-84+ CE

#5
Lua, 152
JS, 112.
• Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
Co-founder & co-administrator of TI-Planet and Inspired-Lua

#### JWinslow23

Updated!
• Calculators owned: TI-84+, TI-84+ CSE, TI-84+ CE

#### DJ Omnimaga

Gode move to cross-post this I think. It will get more participants
• Calculators owned: TI-84 Plus, TI-84 Plus C Silver Edition, TI-84 Plus CE, Casio fx-CG10, HP Prime, fx 1.0 Plus, fx-7400G Plus, fx-9750G Plus, fx-9860G, HP 39gII
• Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Nintendo 64, Wii U

#### Unicorn

Indeed, also, ti basic is winning!
• Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
• Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???

#### Duke "Tape" Eiyeron

TI-Basic helps because "DispGraph" is not 9 bytes but one because it's actually a token. Do TI-89 basic and it'll be heavier, probably.
• Calculators owned: A lot.

#### Snektron

#10
Quote from: Unicorn on July 01, 2015, 10:02:39 AM
Indeed, also, ti basic is winning!
HISS HISS MOTHERF
83 bytes, Python.
• Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...

#### JWinslow23

Quote from: DJ Omnimaga on July 01, 2015, 04:02:22 AM
Gode move to cross-post this I think. It will get more participants
Yeah, thanks. That's my thought process too.
Quote from: Cumred_Snektron on July 01, 2015, 03:39:19 PM
Quote from: Unicorn on July 01, 2015, 10:02:39 AM
Indeed, also, ti basic is winning!
HISS HISS MOTHERF
83 bytes, Python.
I would just like to point out, some of these languages may not have optimal solutions (I know for a fact that TI-BASIC could be cut down a lot). You can challenge those if you'd like; that's really what Code Golf is all about.

On an unrelated note, I wonder if anybody will be able to send their code to my girlfriend
• Calculators owned: TI-84+, TI-84+ CSE, TI-84+ CE

#### Snektron

I don't even know her name. Tracking down random people on the Inetz?
• Calculators owned: TI-84+
Legends say if you spam more than DJ Omnimaga, you will become a walrus...

#### JWinslow23

Quote from: Cumred_Snektron on July 01, 2015, 04:46:02 PM
I don't even know her name. Tracking down random people on the Inetz?
That's the point. To make people try to no avail to be the one to get a bonus. I think it's possible, but very hard.
• Calculators owned: TI-84+, TI-84+ CSE, TI-84+ CE

#### Unicorn

Do a facial recognition search. Unless that picture is of someone else?
• Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
• Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???