270
\$\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
  • 76
    \$\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

146 Answers 146

2
\$\begingroup\$

LOWER, $40457

72 bytes

ₔₓ₃₆ₔₓ₅₂ₔₓ₄₈ₔₓ₅₂ₔₓ₅₃ₔₓ₅₅

Try it online!

ₔₓ<num> - print a character with ASCII code <num>

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

Japt, 7 bytes, $232,255

'$+#è#ÿ

Try it online!

\$\endgroup\$
4
  • 1
    \$\begingroup\$ Same idea I had. The byte count on TIO is wrong, though, it's actually 9 bytes. The highest you can manage in 7 is 232256. \$\endgroup\$
    – Shaggy
    Aug 25, 2018 at 17:57
  • \$\begingroup\$ @Shaggy didnt notice, couldnt get 232256 though \$\endgroup\$ Aug 25, 2018 at 19:43
  • \$\begingroup\$ Sorry, that was a typo; should've been 232255. \$\endgroup\$
    – Shaggy
    Aug 25, 2018 at 19:47
  • \$\begingroup\$ @Shaggy The byte count is correct in Japt’s native ISO-8859-1 encoding. \$\endgroup\$ Aug 29, 2018 at 23:44
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\$

K (oK), 13 bytes, $145794

Try it online!

"$",$*/"B//"

Run multiplication over the characters B//, it will convert them to their integer counterparts and give the result of B*/*/ (145794), String the result ($) and join (,) it to "$"

\$\endgroup\$
0
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\$

Gol><>, $232104 (7 bytes)

$'onhè

Well, I don't think this can get much smaller or higher in price! (and I know that the last char is a 2 byte char, I included it in the byte count)

There is a program that outputs a higher price, but it uses an error, in ><>, here is a link, which also works in Gol><> too!

5th version, $210104 (8 bytes)

$'ofe*nh

Only 120.1$ off from being the max score, whew!

4th version, $182182 in 9 bytes

$'oed*:nh

3rd version, $168168 in 11 bytes

'$'oce*:nn;

2nd version, $150150 in 12 bytes

'%'Moaf*:nn;

Literally 2 minutes after I made the previous one, I figured out how to golf it more.

1st version, $121121, 14 bytes

d:+a+ob:*:n:n;

|

|

|

Yep, that's it.

This can probably be golfed better with more money.

\$\endgroup\$
0
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\$

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
2
\$\begingroup\$

Hexagony, $220220, 7 bytes

Ü~;]!@

Try it online!

This is my first Hexagony answer using []. This instruction switches between pointers and I've never really needed them before. Formatted, this is a size 2 hexagon.

 Ü ~
; ] !
 @ .

The Ü character has ordinal value 220, and we then negate that and output. (-220)%256 = 36, the ordinal value of $. Next we need to negate it back to 220, print twice and exit. However, if we implement this naively (just ~!!@), then that totals up to 8 bytes, which brings us over the $210224 limit. Instead we switch to the next pointer, which starts at the top right moving southeast. This executes the ~!, before wrapping round to the center, which pushes the value of Ü again, before switching again. Now we're on the right corner going southwest, printing again before wrapping around to the the center, negating and switching. Finally, we're in the bottom right moving west, which takes us to the @ to terminate.

To help visualise this, you can use the excellent Hexagony IDE at hexagony.net

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

Nibbles, $300000 (4.5 bytes)

"$"++;*;$

Attempt This Online!

"$"++;*;$
"$"       "$"
   +      Add
    +      add
     ;      x :=
      *      multiply
       ;$     1000
              100
            x
           x

This assumes that we don't have to round up fractional byte counts. Another solution which works without this assumption:

Nibbles, $256256 (5.5 bytes)

"$"*+;$~ch~

Attempt This Online!

"$"*+;$~ch~
"$"         "$"
   *        Multiply
    +  ~     add 1
     ;$       1000
        ch~  256
\$\endgroup\$
2
\$\begingroup\$

Vyxal, $177827 (10 bytes) $192450 (9 bytes) $210224 (8 bytes)

Thanks to Kevin Cruijssen for -1 byte and me for -1 byte

\$»∧<i»J

Run it

Explanation:

\$       # Push a dollar sign
  »∧<i»  # Push salary (base-255-compressed)
       J # Concatenate
         # Implicit print
\$\endgroup\$
4
  • \$\begingroup\$ You can go to 9 bytes and $192,450.00 by replacing the and , with a single trailing J (merge two items together & implicit output the result). :) Try it online. Maybe even 8 bytes is possible if there is a join flag in Vyxal? \$\endgroup\$ Mar 28, 2023 at 21:03
  • 1
    \$\begingroup\$ Just got down to 8 bytes by compressing 210224 into base-255. \$\endgroup\$
    – Joao-3
    Mar 28, 2023 at 21:22
  • \$\begingroup\$ @KevinCruijssen I would have to include that flag in the byte count anyways. \$\endgroup\$
    – Joao-3
    Mar 29, 2023 at 15:52
  • \$\begingroup\$ Program flags are simply considered as different languages instead of counting towards the byte-count (since 2017). So in Vyxal this would be 8 bytes, but in (for example) Vyxal S this would be 7 bytes (S is the flag to join by spaces, but unfortunately it puts spaces between the digits instead of between the $ and number. I'm not sure if there is a flag to just output the joined result without delimiter.) \$\endgroup\$ Mar 29, 2023 at 20:05
2
\$\begingroup\$

Aheui (esotope), 24 bytes, $91300

븖븜뜨쁘멓희다멍

Try it online!

Turned out to be surprisingly close to the bound of $92223.

밞밤따빠맣    9 4 * dup putchar; prints '$' (36) and leaves 36 on the stack
빠따밤밞      dup * 4 9; [1296 4 9]
망더          loop: print +; print 9, add, print 1300, break
희            halt
\$\endgroup\$
2
\$\begingroup\$

Thunno 2 j, 5 bytes, $262,144

kk³'$

Maximum for 5 bytes is $299,069

Explanation

kk      # Push 64 to the stack
  ³     # Pop and push 64 ** 3
   '$  '# Push the string "$"
        # The j flag joins the stack
        # (which is reversed in Thunno 2)
        # Implicit output

Screenshot

Screenshot

\$\endgroup\$
2
  • \$\begingroup\$ The first two answers violate the “no numbers” restriction. I’d think the third one is okay, though, because ³ isn’t 3. \$\endgroup\$
    – Bbrk24
    Apr 22, 2023 at 17:05
  • \$\begingroup\$ @Bbrk24 oops, didn't see the "no numbers" rule in my rush to answer. Thanks for pointing it out. \$\endgroup\$
    – The Thonnu
    Apr 22, 2023 at 17:33
2
\$\begingroup\$

Vyxal RssṪ, 26 bitsv1, 3.25 bytes ($371091)

\$»*

Try it Online!

If the interviewer is going to play dirty, then so am I. That'll teach companies to put arbitrary restrictions on their job offerings!

\$\endgroup\$
0
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\$
    – SQLSam
    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\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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