259
\$\begingroup\$

As I'm applying for some jobs whose job advert doesn't state the salary, I imagined a particularly evil interviewer that would give the candidate the possibility to decide their own salary ...by "golfing" it!

So it goes simply like that:

Without using numbers, write a code that outputs the annual salary you'd like to be offered.

However, being able to write concise code is a cornerstone of this company. So they have implemented a very tight seniority ladder where

employers that write code that is b bytes long can earn a maximum of ($1'000'000) · b-0.75.

we are looking at (these are the integer parts, just for display reasons):

   1 byte  → $1'000'000       15 bytes → $131'199
   2 bytes →   $594'603       20 bytes → $105'737
   3 bytes →   $438'691       30 bytes →  $78'011
   4 bytes →   $353'553       40 bytes →  $62'871
  10 bytes →   $177'827       50 bytes →  $53'182

The challenge

Write a program or function that takes no input and outputs a text containing a dollar sign ($, U+0024) and a decimal representation of a number (integer or real).

  • Your code cannot contain the characters 0123456789.

In the output:

  • There may optionally be a single space between the dollar sign and the number.

  • Trailing and leading white spaces and new lines are acceptable, but any other output is forbidden.

  • The number must be expressed as a decimal number using only the characters 0123456789.. This excludes the use of scientific notation.

  • Any number of decimal places are allowed.

An entry is valid if the value it outputs is not greater than ($1'000'000) · b-0.75, where b is the byte length of the source code.

Example output (the quotes should not be output)

"$ 428000"            good if code is not longer than 3 bytes
"$321023.32"          good if code is not longer than 4 bytes
"  $ 22155.0"         good if code is not longer than 160 bytes
"$ 92367.15 \n"       good if code is not longer than 23 bytes
"300000 $"            bad
" lorem $ 550612.89"  bad
"£109824"             bad
"$ -273256.21"        bad
"$2.448E5"            bad

The score

The value you output is your score! (Highest salary wins, of course.)


Leaderboard

Here is a Stack Snippet to generate both a regular leaderboard and an overview of winners by language.

To make sure that your answer shows up, please start your answer with a headline, using the following Markdown template:

# Language Name, $X (Y bytes)

where X is your salary and Y is the size of your submission. (The Y bytes can be anywhere in your answer.) If you improve your score, you can keep old scores in the headline, by striking them through. For instance:

# Ruby, <s>$111111.111... (18 bytes)</s> <s>$111999 (17 bytes)</s> $123456 (16 bytes)

You can also make the language name a link, which will then show up in the leaderboard snippet:

# [><>](http://esolangs.org/wiki/Fish), $126,126 (13 bytes)

var QUESTION_ID=171168,OVERRIDE_USER=77736;function answersUrl(e){return"https://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function commentUrl(e,s){return"https://api.stackexchange.com/2.2/answers/"+s.join(";")+"/comments?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+COMMENT_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(answer_page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),answers_hash=[],answer_ids=[],e.items.forEach(function(e){e.comments=[];var s=+e.share_link.match(/\d+/);answer_ids.push(s),answers_hash[s]=e}),e.has_more||(more_answers=!1),comment_page=1,getComments()}})}function getComments(){jQuery.ajax({url:commentUrl(comment_page++,answer_ids),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){e.items.forEach(function(e){e.owner.user_id===OVERRIDE_USER&&answers_hash[e.post_id].comments.push(e)}),e.has_more?getComments():more_answers?getAnswers():process()}})}function getAuthorName(e){return e.owner.display_name}function process(){var e=[];answers.forEach(function(s){var r=s.body.replace(/<(s|strike)>.*?<\/\1>/g,"");s.comments.forEach(function(e){OVERRIDE_REG.test(e.body)&&(r="<h1>"+e.body.replace(OVERRIDE_REG,"")+"</h1>")});var a1=r.match(SCORE_REG),a2=r.match(LANG_REG),a3=r.match(BYTES_REG);a1&&a2&&e.push({user:getAuthorName(s),size:a3?+a3[1]:0,score:+a1[1].replace(/[^\d.]/g,""),lang:a2[1],rawlang:(/<a/.test(a2[1])?jQuery(a2[1]).text():a2[1]).toLowerCase(),link:s.share_link})}),e.sort(function(e,s){var r=e.score,a=s.score;return a-r});var s={},r=1,a=null,n=1;e.forEach(function(e){e.score!=a&&(n=r),a=e.score,++r;var t=jQuery("#answer-template").html();t=t.replace("{{PLACE}}",n+".").replace("{{NAME}}",e.user).replace("{{LANGUAGE}}",e.lang).replace("{{SCORE}}","$"+e.score.toFixed(2)).replace("{{SIZE}}",e.size||"?").replace("{{LINK}}",e.link),t=jQuery(t),jQuery("#answers").append(t);s[e.rawlang]=s[e.rawlang]||e});var t=[];for(var o in s)s.hasOwnProperty(o)&&t.push(s[o]);t.sort(function(e,s){var r=e.rawlang,a=s.rawlang;return r>a?1:r<a?-1:0});for(var c=0;c<t.length;++c){var i=jQuery("#language-template").html(),o=t[c];i=i.replace("{{LANGUAGE}}",o.lang).replace("{{NAME}}",o.user).replace("{{SCORE}}","$"+o.score.toFixed(2)).replace("{{SIZE}}",o.size||"?").replace("{{LINK}}",o.link),i=jQuery(i),jQuery("#languages").append(i)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",COMMENT_FILTER="!)Q2B_A2kjfAiU78X(md6BoYk",answers=[],answers_hash,answer_ids,answer_page=1,more_answers=!0,comment_page;getAnswers();var LANG_REG=/<h\d>\s*((?:[^\n,](?!\s*\(?\d+\s*bytes))*[^\s,:-])/,BYTES_REG=/(\d+)\s*(?:<a[^>]+>|<\/a>)?\s*bytes/i,SCORE_REG=/\$\s*([\d',]+\.?\d*)/,OVERRIDE_REG=/^Override\s*header:\s*/i;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:520px;float:left}table thead{font-weight:700}table td{padding:5px}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b"> <div id="answer-list"> <h2>Leaderboard</h2> <table class="answer-list"> <thead> <tr><td></td><td>Author</td><td>Language</td><td>Score</td><td>Size</td></tr></thead> <tbody id="answers"> </tbody> </table> </div><div id="language-list"> <h2>Winners by Language</h2> <table class="language-list"> <thead> <tr><td>Language</td><td>User</td><td>Score</td><td>Size</td></tr></thead> <tbody id="languages"> </tbody> </table> </div><table style="display: none"> <tbody id="answer-template"> <tr><td>{{PLACE}}</td><td>{{NAME}}</td><td>{{LANGUAGE}}</td><td>{{SCORE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table> <table style="display: none"> <tbody id="language-template"> <tr><td>{{LANGUAGE}}</td><td>{{NAME}}</td><td>{{SCORE}}</td><td>{{SIZE}}</td><td><a href="{{LINK}}">Link</a></td></tr></tbody> </table>


Edit: (rounded) maximum allowed score per byte count, for a quicker reference - text here:

enter image description here

\$\endgroup\$
9
  • 75
    \$\begingroup\$ This is one of the very few (imo) successful non-fixed-output no-input non-random challenge. Unique idea! \$\endgroup\$
    – Mr. Xcoder
    Aug 26, 2018 at 0:45
  • 4
    \$\begingroup\$ Nice challenge! Can we output a fully formatted currency value, if desired? Like $80,662.67 instead of $80662.6659? Your rules seems to preclude the comma, which means I couldn't use any built-in currency functions. \$\endgroup\$
    – BradC
    Aug 27, 2018 at 19:07
  • 7
    \$\begingroup\$ I hope you don't mind, I've added a variation of the Leaderboard Snippet that sorts by score instead of bytes. Excellent first challenge! \$\endgroup\$ Aug 27, 2018 at 19:27
  • 12
    \$\begingroup\$ Just noticed the new contributor tag. Well-constructed challenge, with such a high upvote and a vast amount of answers in only a few days, I wonder if this could be eligible for this years' Rookie of The Year ;) \$\endgroup\$ Aug 28, 2018 at 11:21
  • 4
    \$\begingroup\$ I've nominated this challenge as a candidate for "Rookie of the Year - Challenges" category in Best of PPCG 2018 as I said back then. \$\endgroup\$ Feb 8, 2019 at 8:22

133 Answers 133

2
\$\begingroup\$

><>, 8 bytes ($196196)

code:

e|noi:*

input:

$

Try it online!

My first ever ><> entry; ><> is a weird language and it took me a while to find a way to print the $ without using a ton of characters. If it wasn't needed, f|n:* would print 225225 inside the $299069 limit. Instead, stuck with 8 characters and a $210224 limit. But hey, $196196/yr. is some serious money.

How it works

 e|noi:*
>          Fish starts top left, pointing right
 e         Push 14 onto the stack (stack: [14])
  |        Mirror. Fish is now moving left
 e         Push 14 onto the stack again, wrap around (stack: [14,14])
       *   Pop x and y, multiply, push result (stack: [196])
      :    Duplicate top of the stack (stack: [196,196])
     i     Read a character from input as a string ($), push to stack (stack: ['$',196,196])
    o      Pop and print it as a character (output `$`, stack: [196,196])
   n       Pop and print as a number (output `$196`, stack: [196])
  |        Mirror. Fish is now moving right
   n       Pop and print as a number (output `$196196` stack: [])
    o      Pop, stack is empty: error; program terminates
\$\endgroup\$
3
  • 3
    \$\begingroup\$ Challenge said no input... Nice language, still. \$\endgroup\$ Aug 26, 2018 at 7:19
  • \$\begingroup\$ @StéphaneGourichon Oh shoot! :\ \$\endgroup\$ Aug 26, 2018 at 15:54
  • \$\begingroup\$ Revisted this a couple times and the best I can get without input is e6|n:*o*} (9 char, $196196 and too high). Managed an 8-char, but c3*:|no* only returns $129636 which is a third lower. \$\endgroup\$ Aug 29, 2018 at 19:13
2
\$\begingroup\$

K (oK), $130,331.00 of a maximum of $131,199.00 (15 bytes)

"$",$*/`i$"//;"

Try it online!

Output contains quotation marks because that's how strings are represented in K.

How:

"$",$*/`i$"//;" # Anonymous function, no arguments.
          "//;" # The string '//;'
       `i$      # coerce into integers (uses the ascii values of '//;', which are 47 47 59)
     */         # product of the list (47² × 59 = 130.331)
    $           # convert into a string
   ,            # and prepend
"$"             # a dollar sign
\$\endgroup\$
3
  • \$\begingroup\$ You might want to change your decimal format to US instead of Europe (commas as thousand separator and dots as decimal separator). The leader-board in the question currently shows your answer at the bottom with $130.33.. ;) Nice answer though, +1 from me! \$\endgroup\$ Aug 27, 2018 at 20:46
  • \$\begingroup\$ @KevinCruijssen just did that, thanks! \$\endgroup\$
    – J. Sallé
    Aug 27, 2018 at 20:57
  • \$\begingroup\$ You don't need to cast it, "$",$*/"//;" works just as well and puts you at a higher cap \$\endgroup\$
    – Thaufeki
    Sep 28, 2018 at 3:40
2
\$\begingroup\$

Excel: 23 bytes, $93648.047476083

="$"&PI()^(ARABIC("X"))

Max is $95214.73 (2 bytes can be saved, but no salary improvement by removing parentheses around the ARABIC function)

Excel: 15 bytes, $131196.0508, Max $131,199 (Cheat)

="$"&NOW()*PI()

For certain values of now() :-) (Set system date to 5/2/2014)

\$\endgroup\$
2
\$\begingroup\$

Befunge-93, $154836 $164220 $165554, 12 11 bytes

".;=$",**.@

Try it online!

I calculated the Number using the ASCII Values of the letters

46 * 59 * 61 = 165554

Thanks to Jo King for golfing 1 byte and raising my salary by $9384 $10718.

\$\endgroup\$
2
  • \$\begingroup\$ @JoKing Thank you, I think the code is now only improvable by changing the ASCII Characters, but I haven't found a better combination yet. \$\endgroup\$
    – ItsJ0el
    Aug 28, 2018 at 6:21
  • 1
    \$\begingroup\$ 6 dollars off the max \$\endgroup\$
    – Jo King
    Aug 28, 2018 at 6:35
2
\$\begingroup\$

ShinyLisp, 8 bytes, $204864

S"$"DpEv

Ungolfed:

(strings "$" drop even)

drop is a function which discards the first few elements of a list. When used as a number, it's equal to 2048. even checks whether a number is even, but when used as a number, it's equal to 64. strings concatenates strings, so the two functions get cast to numbers which then get cast to strings.

\$\endgroup\$
2
\$\begingroup\$

MATLAB, 22 bytes, $99649.9031

['$',num2str(''''^pi)]

$99649.9031

Just bad luck the character ' is part of the syntax so to escape it I needed to repeat it.

This solution and all the other below are interchangeable with the sprintf function. Ex sprintf('$%f',''''^pi) will return the same output.


Older solutions:

23 bytes, $80662.6659

['$',num2str(pi^pi^pi)]

$80662.6659

24 bytes, $74704.2869

['$',num2str(now/pi/pi)]

$74704.287

Explanation: the now function return a serial date code (today 29-August-2018 => 737301). Just needed to divide that a bit to make the salary fit the cap.

Nice thing about it, if you run it tomorrow you'll get a bit more (pennies only though...)

\$\endgroup\$
2
\$\begingroup\$

C, $80010 (29 bytes)

o(){printf("$%d",'\aq'*'*');}

Try it online!

I did a brute-force search on all expressions x * y, where x is a 2-character literal and y is a char. The desired result has a rather uncomfortable value, which requires one of the chars to be escaped: \a (which is equal to 7).

For a 29-byte program, the maximum that may be displayed is 80020.


Fun fact: my search program printed all solutions literally at first. Imagine what it did when it output all these \a characters...

\$\endgroup\$
3
  • \$\begingroup\$ You don’t have to escape that. And why not use a 3-character literal? \$\endgroup\$ Aug 30, 2018 at 3:59
  • \$\begingroup\$ No real reason to avoid these literals, other than them being ugly. You might want to post your solution, because it's different/better than mine. \$\endgroup\$
    – anatolyg
    Aug 30, 2018 at 10:05
  • \$\begingroup\$ Do the rules allow you to skip main? This code doesn't compile... \$\endgroup\$
    – l33t
    Oct 20, 2018 at 14:10
2
\$\begingroup\$

Pepe, $74088 (30 bytes)

reeeEeeEeerEeeEeEeEerEeeEereEE

Try it online!

Explanation

reeeEeeEee                     # print $
          rEeeEeEeEe           # push 42 in stack r
                    rEeeEe     # cube of 42 (74088)
                          reEE # output number
\$\endgroup\$
2
\$\begingroup\$

brainfuck, 30 bytes, $77'777

-[[<->->+>++++<<]>-]>.<<<.....

BF-Crunch did most of the work for me.

Try it online!

\$\endgroup\$
2
\$\begingroup\$

Actually, 8 bytes, $196418

'←┘F$'$+

Explanation:

'←┘F$'$+
'←        push the string "←"
  ┘       CP437 ordinal (27)
   F      27th Fibonacci number (F(27) = 196418)
    $     convert to string
     '$+  prepend a dollar sign

Try it online!

\$\endgroup\$
0
2
\$\begingroup\$

Stax, 6 bytes ($256256)

¥r○s╙$

Run and debug it

Unpacked version:

VB$c'$L Full program
VB$     Push "256"
   c    Copy
    '$  Push "$"
      L Listify stack, producing ["$", "256", "256"]
        Implicit flatten and output
\$\endgroup\$
2
\$\begingroup\$

Braingolf, 8 bytes, $209,764

#$@#å+*

Output:

$209764

209764 < 1e6 * 8-0.75

Try it online!

\$\endgroup\$
2
  • \$\begingroup\$ nice to see somebody else using braingolf! \$\endgroup\$
    – Mayube
    Nov 30, 2018 at 15:02
  • 1
    \$\begingroup\$ #$!@**8/ gives $209952 in the same number of bytes by doing (36^2)^2 / 8 \$\endgroup\$
    – Mayube
    Nov 30, 2018 at 15:13
2
\$\begingroup\$

Zsh, $127569, 15 bytes

];<<<\$$?${-%?}

Try it online!

Squeezing out a bit more than the Bash answer by abusing the default flags. By default, the $- parameter is set to 569X. ${ %?} removes the last character. We can actually get a lot further by manually controlling the flags:

zsh -178, $156789, 11 bytes

<<<\$${-%?}

Try it online!


If the exponent was slightly more favorable (-0.74 instead of -0.75), I could get quite the bonus: zsh +X5 -2378 '<<<\$$-' (7 bytes and $236789). Maybe management could be convinced next year...

\$\endgroup\$
2
  • \$\begingroup\$ I believe command-line arguments are included in the byte count. Good answer, though! \$\endgroup\$
    – Purple P
    Oct 2, 2019 at 7:28
  • \$\begingroup\$ @PurpleP I like the reasoning of this meta post, but feel free to draw your own conclusions. :P \$\endgroup\$ Oct 2, 2019 at 12:29
2
\$\begingroup\$

C# 29 20 19 Bytes

Assuming it's allowed to omit the otherwise required Main() entry point and assuming using System;...

Swapped to the interactive C# compiler and have saved now 10 bytes - 8 from removing Console and another by using an ascii character instead. And since it's the only line a semicolon isn't necessary. Not a bad salary :P

Write("$"+'Ϩ'*'m');

Output: $109000

Try it online!

\$\endgroup\$
2
\$\begingroup\$

LOLCODE 1.2, 19 77 Bytes ($38100)

HAI 1.2
    VISIBLE "$:[DIGIT THREE]:[DIGIT EIGHT]:[DIGIT ONE]:[DIGIT ZERO]:[DIGIT ZERO]"
KTHXBYE

Try it online!

The header HAI 1.2 and footer KTHXBYE are always required so not included in final byte count.

LOLCODE lacks a way to directly cast a char literal to a number, but you CAN give it a unicode normative name and it returns that unicode character. Changing the number name frequently changed the byte count so this was a bit tricky but this worked out fine :)

(Also had brainfart and forgot including 0123456789 wasn't allowed hence the 19 → 77. ^^;)

\$\endgroup\$
2
\$\begingroup\$

Python 2 (Cython), $101106 $101937 $105737 (21 20 bytes)

Another Unicode character solution. This is the closest printable character I could find to the 21-byte maximum amount. Don't think Python can get any higher than this...

print"$",ord("𙴉")

Outputs:

$ 105737

How it works

"𘫲" is 4-byte char U+18AF2 "TANGUT COMPONENT-755". 0x18af2 = 101106 in decimal.

Edit: Thanks to Dennis for pointing out that there's a usable character with a higher value and earning more money!

"𘸱" is 4-byte char U+18E31. 0x18e31 = 101937 in decimal.

Edit: Thanks to ovs for pointing out that the u prefix isn't necessary in Cython! An extra byte is gained: TIO

"𙴉" U+19D09. 0x19d09 = 105737.

NOTE: this works in TIO but fails in Python console with TypeError: ord() expected a character, but string of length 4 found

\$\endgroup\$
4
  • 1
    \$\begingroup\$ You don't have to use printable characters; U+18E31 will work just as well. Try it online! (using Cython because CPython would require a magic comment) \$\endgroup\$
    – Dennis
    Aug 28, 2018 at 15:29
  • \$\begingroup\$ Oh that's great, thank you! In charmap there was a big gap after U+18AF2, thought it was a reserved area, but must have been the font I was using. \$\endgroup\$
    – Aaron F
    Aug 29, 2018 at 18:51
  • 1
    \$\begingroup\$ With Cython you don't seem to need the u, so you can go a bit higher. \$\endgroup\$
    – ovs
    Jun 14, 2021 at 10:48
  • \$\begingroup\$ thanks @ovs! I've just updated the answer. It feels a bit like cheating now it doesn't work in the Python console, but it's an extra $3800 so I don't mind :-D \$\endgroup\$
    – Aaron F
    Jun 14, 2021 at 18:06
1
\$\begingroup\$

Flobnar, 16 bytes, $123904

$,g<+<>!
@X:+<*\

Try it online!

A little hard since I couldn't use numbers, but I got around it by using the get command.

Explanation:

........   Start the program
@......    Evaluate left and print result

......>.   Evaluate to the right
......\

$......!  Invert
.......   Pop the top of the call stack (does nothing)

$,g.....  Print the cell at:
..:....     Top of the call stack (0,0 => $)

.,.....!  , returns 0, ! inverts that to 1 and 
......\     \ stores it in the call stack

...<+<..  Return ((Z+Z)+(Z+Z))*((Z+Z)+(Z+Z))
...+<*.     Where Z is the return of the leftmost arrow

..g.....  Return the cell at:
.X:....     Top of the call stack (1,1 => X (88))
\$\endgroup\$
1
\$\begingroup\$

VBA, 21 bytes, $101,126

Max salary for 21 bytes: $101937.86

?"$"ASC("e")&ASC("~")

Literally just prints $, 101 and 126 without spaces

Golfing wise: VBA will automatically concatenate a string followed by a number or function, so there is no & required between ?"$" and ASC("e")

If the & is omitted, then you get spaces between the strings and numbers - if this is a valid output then for 20 bytes you can use ?"$"ASC("i")ASC("~") to get $ 105 126 (max salary: $105,737.13)

\$\endgroup\$
1
  • \$\begingroup\$ You could just use ÿ to get a slightly higher salary. ?"$"ASC("e")&ASC("ÿ") $101255 \$\endgroup\$
    – OWSam
    Aug 28, 2018 at 15:01
1
\$\begingroup\$

Common Lisp, $72447 (33 bytes)

(format t"$~d"(char-code #\𑫿))

The character is Unicode U+11AFF.

Try it online!

\$\endgroup\$
1
\$\begingroup\$

SmileBASIC, 10 bytes, $131072

?"$";#R*#L

#R and #L are constants with values of 512 and 256.

\$\endgroup\$
1
\$\begingroup\$

x86 (32-bit) machine code, $124124

Hexdump (16 bytes):

b8 3a 1d e3 03 f7 e0 89 01 c1 e8 08 89 41 04 c3

Disassembly:

b8 3a 1d e3 03  mov eax, 65215802
f7 e0           mul eax
89 01           mov[ecx], eax
c1 e8 08        shr eax, 8
89 41 04        mov[ecx + 4], eax
c3              ret

I found the "magic" number 65215802 by brute-force search. Its square is hexadecimal F1C2C34323124. When interpreted as a 4-byte string, it's $124. After a shift by 8 bits right, it's 124, with a zero-byte string terminator.

For a 16-byte program, the maximum that may be displayed is $125000.

\$\endgroup\$
1
\$\begingroup\$

Python 2, $65536 (34 bytes)

An answer using mathematical operators:

t=True;t+=t;t<<=t;print"$",t**t>>t

How it works

t=True;    # True evaluates to 1
t+=t;      # 1 + 1 = 2
t<<=t;     # 2 << 2 = 8
print"$",  # Python 2's print statement doesn't need parentheses or whitespace
t**t>>t    # 8 ** 8 = 16777216
           # 16777216 >> 8 = 65536
\$\endgroup\$
1
\$\begingroup\$

GS2, 4 bytes ($256256)

•$▼▼

Try it online!

Just thought I'd add this as there were no 4 byte solutions. There are probably better solutions of 4 bytes, it'd be interesting to see what the highest is.

Explanation:

•$    Push a '$' character on the stack
  ▼   Push 256 on the stack
   ▼  Push 256 on the stack
\$\endgroup\$
2
  • \$\begingroup\$ Does GS2 use its own encoding table? If not doesn't seem like a single byte but 4, so the length of your code would be 10 bytes. Please correct me if I'm wrong. \$\endgroup\$
    – Skillmon
    Aug 31, 2018 at 22:27
  • \$\begingroup\$ @Skillmon this is actually the first program I've written in GS2. From the other answers, it seems like tio.run uses code page 437 (which is linked in other answers). From there I checked the docs to find the appropriate bytes and got this. \$\endgroup\$
    – maxb
    Sep 1, 2018 at 7:23
1
\$\begingroup\$

SQLite, 26 bytes, $86850

select'$'||unicode('𕍂')

Try it online!

Inspired by T-SQL @BradC answer

\$\endgroup\$
1
\$\begingroup\$

FreeBASIC, $124095 (16 bytes)

?"$" &&hc &&hfff

prints

$124095

? means print

&h is the hex prefix

& connects parts together

Tested using FreeBASIC online

\$\endgroup\$
1
\$\begingroup\$

Forth (gforth), $104857 $125000 (16 bytes)

." $"char 𞡈 .

Try it online!

\$\endgroup\$
1
  • \$\begingroup\$ +1 I feel silly for only now realizing that you don't need a space after the closing " to a ." word \$\endgroup\$
    – reffu
    Aug 27, 2018 at 16:46
1
\$\begingroup\$

Excel, 10 16 bytes, $177827 $125000

="$"&ROW()

Not sure if this is a valid entry. It returns $ following the current row number. So if you put it on row 177827 125000, it will return $177827$125000

\$\endgroup\$
6
  • \$\begingroup\$ As the number of digits in the number are the same length as the formula: &ROW() | 177827, you could just replace it to ="$177827" for the same bytes but doesn't require getting to row 177,827. \$\endgroup\$ Aug 31, 2018 at 11:18
  • \$\begingroup\$ Indeed, but the rules state that I cannot use numbers :) \$\endgroup\$
    – Moacir
    Aug 31, 2018 at 11:21
  • 1
    \$\begingroup\$ I've been awake for far too long, completely forgot the challenge rules. I guess I shall leave my comment so people can see my idiocy. lol \$\endgroup\$ Aug 31, 2018 at 11:22
  • \$\begingroup\$ I’m pretty sure the row number needs to be included in the byte count when used in this way, per this standard loophole, so this is 16 bytes, not 10. \$\endgroup\$ Sep 3, 2018 at 17:47
  • \$\begingroup\$ Got it. What is the correct course of action in this case? Do I delete my answer or edit it to be 16 bytes(Or less, considering I have to use the byte limitation of the question)? \$\endgroup\$
    – Moacir
    Sep 3, 2018 at 17:58
1
\$\begingroup\$

MATL, 12 bytes, $155052

'$'t';I'hpVh

(Maximum for 12 bytes is $155100)

Explanation:

'$'t';I'hpVh

'$'             String literal
   t            Duplicate
    ';I'        String literal, product of which results in highest bound by $_max / 38
        h       Horizontal concat
         p      Product (implicitly converts to int)
          V     Convert to string
           h    Horizontal concat
\$\endgroup\$
1
\$\begingroup\$

Common Lisp, 59 bytes $46974

(defun x()(format nil "~{~a~}"(list'"$"(char-code #\띾))))

Try it online!

\$\endgroup\$
1
\$\begingroup\$

JavaScript, 31 bytes, $74088

(x='*'.charCodeAt())=>'$'+x*x*x

The * asterisk character decimal code point 42 cubed is 74088 Try it online!

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.