* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: Code Golf Belgium Numbers  (Read 252 times)

0 Members and 1 Guest are viewing this topic.

Offline PT_

  • Full User
  • Join Date: Mar 2016
  • Location:
  • Posts: 270
  • Post Rating Ratio: +11/-0
Code Golf Belgium Numbers
« on: August 16, 2017, 06:37:13 pm »
Hello ladies and gentlemen!

It was a rather long time ago that Code Golf - The Reboot was active, and I enjoyed it so much, that I decided it would be fun to pick that up again. So here I am with a new task. Don't know what Code Golf is? Check some old topics. You have one week to complete this task, and entries should be submitted by sending a PM to me. Without any further ado, here is your task:

Write a program that inputs a positive integer and outputs the Belgium k-number of the input. Of course, you have no idea what a Belgium k-number is, so let me explain that first. Let k be one of the integers 0-9. The input N has the Belgium k-number, if N occurs in the increasing sequence which starts with k, and the difference between 2 consecutive numbers in the sequence are the same as the digits of N. See this for a better explanation. Let me give an example.

Code: [Select]
k = 7, N = 85
Sequence starts with 7
7  + 8 = 15
15 + 5 = 20
20 + 8 = 28
28 + 5 = 33
33 + 8 = 41
41 + 5 = 46
46 + 8 = 54
54 + 5 = 59
59 + 8 = 67
67 + 5 = 72
72 + 8 = 80
80 + 5 = 85
STOP
As you can see, 85 is in the sequence (7, 15, 20, 28, 33..), which means 85 as Belgium k-number 7.

Other example:
Code: [Select]
k = 7, N = 152
Sequence starts with 7
7  + 1 = 8
8  + 5 = 13
13 + 2 = 15
15 + 1 = 16
16 + 5 = 21
21 + 2 = 23
23 + 1 = 24
...

Providing that ANY input N has at least 1 Belgium k-number, find one of the Belgium k-numbers with any input.

Good luck! :)

I've no idea if this is a simple or a hard task, we will see later!

Sorry, didn't realize there are already 2 open contests at CW :(



Offline c4ooo

  • Super User
  • CW Contest II Winner
  • *
  • Join Date: Aug 2015
  • Location: 127.0.0.1
  • Posts: 1007
  • Post Rating Ratio: +12/-4
  • Advanced forumer
  • Gender: Male
Re: Code Golf Belgium Numbers
« Reply #1 on: August 16, 2017, 06:54:41 pm »
You should change the name of the thread to "code golf - the reboot - the reboot #1" :P

Anyways, I don't remember you participating in codegolf on omninaga? Lol  9_9  :P

Online Juju

  • aka Yuki Kagayaki aka J̵̭͕͇ù̞̭̝̯̦j̴̭̙̗͖͡ù͏͓̲̕
  • CodeWalrus Staff
  • Super User
  • Server Maintenance
  • Moderator
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Inside a walrus
  • Posts: 3077
  • Post Rating Ratio: +30/-2
  • Couch potato
    • jul.savard
    • juju2143
    • @juju2143
    • juju2143
    • @julosoft
    • juju-kun
    • /u/juju2143
    • juju2143
    • @juju2143
    • Juju's shed
  • Gender: Female
  • WalriiPoints: 99999
Re: Code Golf Belgium Numbers
« Reply #2 on: August 16, 2017, 06:59:36 pm »
And I rebooted the concept just yesterday, what a coincidence? Eh, I dunno, you should had seen it. Anyway. Good to have some contests here. I'll try to do something.

EDIT: What about Code Golf: The CWreboot #2? (#1 is mine, hehe)
« Last Edit: August 16, 2017, 07:10:36 pm by Juju »
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
On semi-hiatus until who knows when. CODEWALRUS 2.0 COMING SOON
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Offline _iPhoenix_

  • Full User
  • Join Date: Mar 2017
  • Location:
  • Posts: 443
  • Post Rating Ratio: +8/-1
  • █████ ▼ ♪ Best music ♫
    • @dj_iPhoenix
    • @UCytgMNPxAMDsxjimvxHf01w
    • @the-legend-of-iphoenix
  • Gender: Male
Re: Code Golf Belgium Numbers
« Reply #3 on: August 16, 2017, 08:08:33 pm »
I'm at 51 bytes, which I suspect is the absolute minimum.

(This is TI-BASIC only, btw)
  • Calculators owned: A sentient TI-84+ CE, TI-85
  • Consoles, mobile devices and vintage computers owned: TI-99/4a home computer
Help me with a project by voting here! Thanks!

"walruses are better than tuxedo chickens, all hail the great :walrii:" ~ me

Online Juju

  • aka Yuki Kagayaki aka J̵̭͕͇ù̞̭̝̯̦j̴̭̙̗͖͡ù͏͓̲̕
  • CodeWalrus Staff
  • Super User
  • Server Maintenance
  • Moderator
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Inside a walrus
  • Posts: 3077
  • Post Rating Ratio: +30/-2
  • Couch potato
    • jul.savard
    • juju2143
    • @juju2143
    • juju2143
    • @julosoft
    • juju-kun
    • /u/juju2143
    • juju2143
    • @juju2143
    • Juju's shed
  • Gender: Female
  • WalriiPoints: 99999
Re: Code Golf Belgium Numbers
« Reply #4 on: August 17, 2017, 05:24:31 am »
Okay, so if I understand, for any input N, find the k number(s), if there's any?

Edit: I'm at 95 bytes in Ruby (or 87 in Ruby 2.4). Cool and good.
« Last Edit: August 17, 2017, 06:53:45 am by Juju »
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
On semi-hiatus until who knows when. CODEWALRUS 2.0 COMING SOON
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Offline PT_

  • Full User
  • Join Date: Mar 2016
  • Location:
  • Posts: 270
  • Post Rating Ratio: +11/-0
Re: Code Golf Belgium Numbers
« Reply #5 on: August 17, 2017, 07:43:54 am »
Exactly. The only difference is that you can assume there is always at least 1 Belgium-k number.

Online Juju

  • aka Yuki Kagayaki aka J̵̭͕͇ù̞̭̝̯̦j̴̭̙̗͖͡ù͏͓̲̕
  • CodeWalrus Staff
  • Super User
  • Server Maintenance
  • Moderator
  • Forum Maintenance
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Inside a walrus
  • Posts: 3077
  • Post Rating Ratio: +30/-2
  • Couch potato
    • jul.savard
    • juju2143
    • @juju2143
    • juju2143
    • @julosoft
    • juju-kun
    • /u/juju2143
    • juju2143
    • @juju2143
    • Juju's shed
  • Gender: Female
  • WalriiPoints: 99999
Re: Code Golf Belgium Numbers
« Reply #6 on: August 17, 2017, 07:47:03 am »
Eh, as I wrote it I'm not assuming anything, it just outputs nothing if it's not a Belgium-k number.

(Also, standings?)
  • Calculators owned: TI-83+ (dead?), Casio Prizm (also dead???)
  • Consoles, mobile devices and vintage computers owned: A lot
On semi-hiatus until who knows when. CODEWALRUS 2.0 COMING SOON
YUKI-CHAAAANNNN
In the beginning there was walrii. In the end there will be walrii. All hail our supreme leader :walrii: --Snektron

if you wanna throw money at me and/or CodeWalrus monthly it's here

Offline kotu

  • -< \'V/,,,
  • Super User
  • Join Date: Aug 2016
  • Location: don't panic
  • Posts: 1162
  • Post Rating Ratio: +7/-11
  • woah
    • dj_kotu
    • @UCAy2ZF4hbc08iStnTn6jgxQ
    • rowanmedhurst
    • @romanov-psyco
    • futurerave.uk
  • Gender: Male
Re: Code Golf Belgium Numbers
« Reply #7 on: August 17, 2017, 08:06:23 am »
quote #3
  • Calculators owned: TI 84+CE-T
  • Consoles, mobile devices and vintage computers owned: Sega Master System, Sony PlayStation 3
SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

Offline PT_

  • Full User
  • Join Date: Mar 2016
  • Location:
  • Posts: 270
  • Post Rating Ratio: +11/-0
Re: Code Golf Belgium Numbers
« Reply #8 on: August 17, 2017, 01:25:38 pm »
Sorry if I was not clear, but your program should input the variable, you can't assume N (or any other variable) is set before the program runs. In TI-BASIC, it looks like
Code: [Select]
Input N or something similar. With Assembly, you are allowed to fetch the input from Ans. It should display/set in Ans at least one k-number.

 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games