I was looking at Stack Exchange today, and I saw this.

http://codegolf.stackexchange.com/questions/17005/produce-the-number-2014-without-any-numbers-in-your-source-code/17214

a) What is the shortest way, in bytes, to produce the number 2015 in TI-BASIC, without using any numbers or tokens that have number characters in them?

I have 21; I think it can be done in under fifteen.

For an additional challenge,
b) The only constant you may use is rand. You will therefore (unless there is a loophole I forget) start your program with rand→rand to produce a deterministic output. I have not yet attempted this part.

Code:
Input Str0
Disp Str0

(as long as the user enters 2015 Razz)
Probably a loophole (maybe 2), but I am indeed not using any number in the code... Razz

1) Nspire-Basic Very Happy
2) Abusing chr/ord


Code:
ord("ߟ")


8 characters, though it's just a one-char string and a function call

Without using Input, I have a one line solution that is 11 bytes.


Code:
int(π^π^√(π)/int(π


Edit: The above was thought to work. However, I forgot about the fact that the inner exponents are evaluated first. Here is the 13 byte solution that fixes it.


Code:
int(π^(π^√(π))/int(π
Ans
Probably cheating but getDate:Ans(1 ... run anytime this year.

Of course this should be a mathematical method ... so ignore it Smile.

Lol number still in there ... replace with n/n as suggested Smile.
tr1p1ea wrote:
getDate:Ans(1


Quote:
without using any numbers

Razz
getDate:Ans(π/π

Better?
hahahaha yeah lol
Here is a 10 byte solution:


Code:
abs(int(⁻π-e^(π^√(π
A very short one (dunno how to count bytes of this one, though...) if you have Omnicalc installed, which provides the Roman numeral conversion routine :

Code:
Rom>Dec("MMXV
Quote:
So, now that it's 2014, it's time for a code question involving the number 2014.

Your task is to make a program that prints the number 2014, without using any of the characters 0123456789 in your code, and independently of any external variables such as the date or time or a random seed.

The shortest code (counting in bytes) to do so in any language in which numbers are valid tokens wins.

Ans/rand/Input/relying on external state of any kind are cheating by the rules on the linked page.

This is basically going to consistent of finding concise invariances in terms of e, π, i.
elfprince13 wrote:
Quote:
So, now that it's 2014, it's time for a code question involving the number 2014.

Your task is to make a program that prints the number 2014, without using any of the characters 0123456789 in your code, and independently of any external variables such as the date or time or a random seed.

The shortest code (counting in bytes) to do so in any language in which numbers are valid tokens wins.

Ans/rand/Input/relying on external state of any kind are cheating by the rules on the linked page.

This is basically going to consistent of finding concise invariances in terms of e, π, i.


It only says external variables, not external state, so Input is technically legal, but yes, I know it's cheating/bending the rules.
π/π+int(π^(π^√(π))/int(π
Potentially useful decompositions:
2*(2^5 * 2^5) - 2^5 - 1
2^5 * 3^2 * 7 - 1
5*13*31



It's also worth pointing out that no string-based digital encoding mechanism can beat the 10-byte mark:
but y
mr womp womp wrote:
but y

Because it's a fun challenge! and we are programming nerds

(I would post something but everything I can think of is bigger)
I can't get anything under thirteen bytes except trivial modifications of one of Electro's routines.

It occurs to me that brute-forcing this one may actually be possible; if there is a nine-byte solution, it will probably have three π tokens, and there are only about twenty useful tokens in this challenge; π, ^, +, -, /, ^, e^(, sqrt(, cbrt(, xrt(, sinh(, etc. If it starts with an int(, that means there are only a few million possibilities to search through, which can probably be greatly reduced.
Got ten bytes; hard to get below that...


Code:
int(ixrooti+e^(π^√π

okay well thats about the best I can do, taking away the useless parenthesis, I still don't think its the best possible but it must be close? Razz
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 2
» All times are GMT - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement