272
\$\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
  • 77
    \$\begingroup\$ This is one of the very few (imo) successful non-fixed-output no-input non-random challenge. Unique idea! \$\endgroup\$
    – Mr. Xcoder
    Commented 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
    Commented 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\$ Commented 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\$ Commented 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\$ Commented Feb 8, 2019 at 8:22

147 Answers 147

1
2 3 4 5
122
\$\begingroup\$

bash, $127127

x;echo \$$?$?

Try it online!

Since the x command doesn't exist, it errors and sets the exit code to 127.

Then, the code outputs a dollar sign followed by $? twice. The $? variable stores the exit code of the previous command, so this outputs $127127 in 13 bytes.

\$\endgroup\$
3
  • 65
    \$\begingroup\$ Funnily enough if you're on Mac and you have XQuartz installed, this won't work because x does exist. As a bonus, it crashed when trying to open it, so I got $11 instead! \$\endgroup\$ Commented Aug 28, 2018 at 7:53
  • 16
    \$\begingroup\$ Use ] instead of x, the former is less likely to exist. \$\endgroup\$
    – pts
    Commented Aug 28, 2018 at 22:30
  • \$\begingroup\$ @numbermaniac Also, such commands were found for installing on ubuntu 19.04: e, q, r. But w is a thing (close to who) and exit successfully, so you get $00 for it! \$\endgroup\$ Commented Jun 23, 2019 at 22:00
77
\$\begingroup\$

Java 8, $131,199.00 (15 bytes)

v->"$"+'e'*'ԓ'

Try it online.

Explanation:

v->            // Method with empty unused parameter and String return-type
  "$"+         //  Return a dollar sign, concatted with:
      'e'*'ԓ'  //  131199 (101 * 1299)

\$131,199.00 < 131,199.31\$

I used a program to generate a printable ASCII character in the range [32, 126] which, when dividing 131199, would have the lowest amount of decimal values. Since 101 can divide 131199 evenly, resulting in 1299, I'm only 31 cents short of my maximum possible salary based on my byte-count of 15.

\$\endgroup\$
3
  • 15
    \$\begingroup\$ Dang, impressively efficient score! \$\endgroup\$ Commented Aug 27, 2018 at 19:38
  • \$\begingroup\$ ... doesn't the program use numbers now after the edit, which is forbidden by the challenge? \$\endgroup\$
    – Laikoni
    Commented Mar 30, 2023 at 17:40
  • \$\begingroup\$ @Laikoni Woops.. I'm an idiot -_- Thanks, rolled back. \$\endgroup\$ Commented Mar 30, 2023 at 17:44
52
\$\begingroup\$

CJam, (5 bytes) $294204.018...

'$PB#

Try it online!

Explanation:

I derived it from Dennis' answer, but looked for combinations of numbers which would yield a higher result. I almost gave up, but I saw that P is the variable for \$\pi\$, and that \$\pi^{11} \approx 294000\$. The letter B has a value of 11 in CJam, giving the code above.

\$\endgroup\$
1
  • 7
    \$\begingroup\$ Since your score is your salary, you should mention it in the header. This answer is currently winning. :) \$\endgroup\$
    – Dennis
    Commented Aug 27, 2018 at 13:31
48
\$\begingroup\$

CJam, 5 bytes, $262'144

'$YI#

Try it online!

How it works

'$     Push '$'.
  Y    Push 2.
   I   Push 18.
    #  Pop 2 and 18 and perform exponentiation, pushing 262144.
\$\endgroup\$
0
42
\$\begingroup\$

R, 20 bytes, $103540.9

T=pi+pi;cat("$",T^T)

Try it online!

The max for 20 bytes is $105737.1, so this is quite close to the salary cap!

This would be a nice raise, and if I get paid to do code golf......

\$\endgroup\$
1
  • 2
    \$\begingroup\$ might be a way to combine pi with a dataset's sum... would require a programmatic approach to evaluate various combination of operators/datasets/pi to get as close to the max as possible. No time for this now but it sounds like a nice challenge in itself. \$\endgroup\$
    – JayCe
    Commented Aug 25, 2018 at 15:37
35
\$\begingroup\$

GS2, (5 bytes) $292,929

•$☺↔A

A full program (shown here using code-page 437). (Maximum achievable salary @ 5 bytes is $299069.75)

Try it online!

Builds upon Dennis's GS2 answer...

•$☺↔A                             []
•$    - push '$'                  ['$']
  ☺   - push unsigned byte:
   ↔  -   0x1d = 29               ['$',29]
    A - push top of stack twice   ['$',29,29,29]
      - implicit print            $292929
\$\endgroup\$
4
  • 1
    \$\begingroup\$ That's 11 bytes, even if it is 5 characters. \$\endgroup\$
    – dotancohen
    Commented Aug 26, 2018 at 8:38
  • 4
    \$\begingroup\$ @dotancohen: 0x0724011d41 is 5 bytes by my count... \$\endgroup\$
    – eggyal
    Commented Aug 26, 2018 at 9:39
  • 3
    \$\begingroup\$ @eggyal: I missed the bit about code-page 437. Nice touch! \$\endgroup\$
    – dotancohen
    Commented Aug 26, 2018 at 10:26
  • 4
    \$\begingroup\$ Dear down-voter, could I have some feedback please; I don't see what is incorrect, not useful, or unclear. \$\endgroup\$ Commented Aug 26, 2018 at 15:10
31
\$\begingroup\$

Self-modifying Brainfuck, 16 bytes, $124444

<.<++.+.++..../$

Try it online!

\$\endgroup\$
6
  • 2
    \$\begingroup\$ You didn't end up using the :, so you can remove it and add another + for $124444. \$\endgroup\$
    – Nitrodon
    Commented Aug 26, 2018 at 1:36
  • \$\begingroup\$ @Nitrodon Ah right, thanks. \$\endgroup\$
    – DELETE_ME
    Commented Aug 26, 2018 at 4:29
  • \$\begingroup\$ After printing the 1, why not count to 3 and then print only 3s? You would save a byte and print a higher number. \$\endgroup\$ Commented Aug 27, 2018 at 19:51
  • \$\begingroup\$ @12431234123412341234123 You'd need to save two bytes. Otherwise, with 15 bytes, you're only allowed up to $131199, $133333 is too much. \$\endgroup\$
    – hvd
    Commented Aug 28, 2018 at 11:24
  • \$\begingroup\$ How about <.<[-<++.+.>]/^C$ (The ^C is \003) or 00000000: 3c2e 3c5b 2d3c 2b2b 2e2b 2e3e 5d2f 0324 <.<[-<++.+.>]/.$ ? Would be 16 Byte and output $124578. \$\endgroup\$ Commented Jun 11 at 11:36
29
\$\begingroup\$

R, 21 bytes $99649.9

cat("$",min(lynx^pi))

Try it online!

A different R approach - see also Giuseppe's answer

Very close to the maximum of $101937 for this bytecount.

Bonus: object.size()

R, 24 bytes $89096

cat("$",object.size(ls))

Try it online!

This is probably system-dependent, but when I ra this on TIO I got $89096 - close to the limit of 92223 for 24 bytes.

\$\endgroup\$
15
  • \$\begingroup\$ neat! I thought about trying to pick a good dataset but I can't figure out where to look to find them...I guess the datasets package makes a lot of sense. \$\endgroup\$
    – Giuseppe
    Commented Aug 25, 2018 at 15:23
  • \$\begingroup\$ @Giuseppe I'm just trying prod and sum randomly... but prod increases too fast ! \$\endgroup\$
    – JayCe
    Commented Aug 25, 2018 at 15:24
  • \$\begingroup\$ sum(volcano) is 690907 but that would have to be about 1 byte to work, haha \$\endgroup\$
    – Giuseppe
    Commented Aug 25, 2018 at 15:30
  • \$\begingroup\$ Great idea using datasets ! \$\endgroup\$
    – digEmAll
    Commented Aug 25, 2018 at 15:32
  • \$\begingroup\$ @Giuseppe good catch I had completely overlooked that! duh. \$\endgroup\$
    – JayCe
    Commented Aug 25, 2018 at 15:41
28
\$\begingroup\$

JavaScript (ES6), 19 bytes, $109,839

_=>atob`JDEwOTgzOQ`

Try it online!

\$109839\$ is the highest integer \$\le 109884\$ which does not produce any digit when prefixed with '$' and encoded in base64.


Without atob() (Node.js), 26 bytes, $86,126

_=>'$'+Buffer('V~').join``

Try it online!

The concatenation of '$' with the ASCII codes of 'V' (86) and '~' (126).

\$\endgroup\$
4
  • \$\begingroup\$ Wow Buffer. First time ever to acknowledge this class ;') \$\endgroup\$ Commented Aug 29, 2018 at 1:04
  • 1
    \$\begingroup\$ @user71546 It could be done in 24 bytes for $91,126 if thousand separators were allowed. But apparently, they're not... :( \$\endgroup\$
    – Arnauld
    Commented Aug 29, 2018 at 5:47
  • \$\begingroup\$ Buffer constructor is deprecated, so that will get longer in future versions \$\endgroup\$
    – mcfedr
    Commented Aug 30, 2018 at 11:35
  • 2
    \$\begingroup\$ @mcfedr We don't care for code golf, as long as a working version of the interpreter is properly specified. \$\endgroup\$
    – Riking
    Commented Aug 31, 2018 at 3:33
22
\$\begingroup\$

PHP, $131116 (8 bytes)

Didn't see one for php and wanted to throw one up. I know someplace in php is a bad typecast that would cut this in half but I can't find it right now.

$<?=ERA;

This just takes advantage of PHP short tags and the PHP built in constants.

Try it online!

\$\endgroup\$
9
  • 1
    \$\begingroup\$ Ha I’ll switch it out for something else tomorrow \$\endgroup\$ Commented Aug 27, 2018 at 8:21
  • 4
    \$\begingroup\$ Instead of <?="$"., just do $<?= and save a few bytes. \$\endgroup\$ Commented Aug 27, 2018 at 10:23
  • 2
    \$\begingroup\$ @IsmaelMiguel nice thanks! Got it down to 8 bytes but didn't take long enough to figure out how to get the other ~70k of my salary. \$\endgroup\$ Commented Aug 27, 2018 at 14:25
  • 1
    \$\begingroup\$ wow didnt knew about this constant, but I couldnt find in docs, can any one help on this? \$\endgroup\$
    – Rafee
    Commented Aug 29, 2018 at 9:28
  • 3
    \$\begingroup\$ @Rafee it's actually not documented any place that I can find. It's a language constant that was added 17 years ago github.com/php/php-src/commit/…. I found it by dumping all available constants and then just starting to grep for the shortest ones. It seems to be provided by the OS seen here gnu.org/software/libc/manual/pdf/libc.pdf on page 195. \$\endgroup\$ Commented Aug 29, 2018 at 14:50
18
\$\begingroup\$

GS2, 5 bytes, $291'000

•$☺↔∟

This is a CP437 representation of the binary source code.

Try it online!

How it works

•$     Push '$'.
  ☺↔   Push 29.
    ∟  Push 1000.
\$\endgroup\$
18
\$\begingroup\$

Excel 19 bytes $107899.616068361

="$"&CODE("(")^PI()

Explanation:

     CODE("(")        // find ASCII code of ( which is 40
              ^PI()   // raise to power of Pi  (40^3.141592654)
 "$"&                 // append $ to the front of it
=                     // set it to the cell value and display
\$\endgroup\$
6
  • 2
    \$\begingroup\$ Welcome to PPCG! \$\endgroup\$ Commented Aug 27, 2018 at 14:53
  • 9
    \$\begingroup\$ +1 Even better, they'll be impressed with your Excel skills and want you to be an account manager. \$\endgroup\$ Commented Aug 27, 2018 at 17:25
  • 2
    \$\begingroup\$ @theREALyumdub is that supposed to be a good thing? I'm not sure I'd take this salary if it means I have to work with Excel on the daily ;) \$\endgroup\$
    – Aaron
    Commented Aug 28, 2018 at 16:04
  • \$\begingroup\$ I'd argue with Excel's accounting formatting, that you can skip the $ entirely, and simply set the formatting to accounting. \$\endgroup\$
    – Selkie
    Commented Aug 29, 2018 at 20:10
  • \$\begingroup\$ @Selkie Accounting format adds a comma, which is disallowed. You could use a custom format of $# though. I wouldn't be sure if I should count this as 15 characters with =CODE("*")^PI() for $125773, or 17 characters (adding 2 for the the format letters) with =CODE(")")^PI() for $116603, or if this is disallowed. \$\endgroup\$ Commented Aug 30, 2018 at 13:01
14
\$\begingroup\$

vim, $99999 $110000 $120000

i$=&pvh*&ur

Try it online!

Uses the expression register (note that there is a <C-r> character, which is invisible in most fonts, between the $ and =, for a total of 13 bytes) to insert the value of the 'pvh' option times the value of the 'ur' option.

'previewheight' is the option that controls the height of preview windows, which is 12 by default.

'undoreload' is the maximum number of lines a buffer can have before vim gives up on storing it in memory for undo, and it defaults to 10,000.

\$\endgroup\$
0
14
\$\begingroup\$

Jelly,  $256000 $256256  (6 bytes) $257256

⁹‘”$;;

A full program. (Maximum achievable salary @ 6 bytes is $260847.43)

Try it online!

How?

⁹‘”$;; - Main Link: no arguments
⁹      - Literal 256                            256
 ‘     - increment                              257
  ”$   - single '$' character                   '$'
    ;  - concatenate                            ['$',257]
     ; - concatenate                            ['$',257,256]
       - implicit print                      -> $257256

Previous...

5 bytes $256256

”$;⁹⁺

('$' concatenate 256, repeat 256 - causing interim implicit printing)

6 bytes $256000:

⁹×ȷṭ”$

(256 × 1000 ṭack '$')

\$\endgroup\$
5
  • 1
    \$\begingroup\$ That looks like 5 characters, but 11 bytes. \$\endgroup\$
    – dotancohen
    Commented Aug 26, 2018 at 8:38
  • 10
    \$\begingroup\$ @dotancohen Jelly uses a custom code page. \$\endgroup\$
    – Carmeister
    Commented Aug 26, 2018 at 9:32
  • \$\begingroup\$ @Carmeister:Nice! \$\endgroup\$
    – dotancohen
    Commented Aug 26, 2018 at 10:25
  • \$\begingroup\$ $256512 \$\endgroup\$
    – Maya
    Commented Aug 26, 2018 at 11:55
  • \$\begingroup\$ @NieDzejkob indeed 6 bytes are available - I have $257256 now :) \$\endgroup\$ Commented Aug 26, 2018 at 12:52
11
\$\begingroup\$

C#

Full program, 72 bytes, $40448 66 bytes, $43008

class P{static void Main()=>System.Console.Write("$"+('T'<<'i'));}

Try it online!

Explanation

Left-shift operator treats chars 'T' and 'i' as integers 84 and 105 respectively and performs shift

Lambda, 19 bytes, $109568 17 bytes, $118784

o=>"$"+('t'<<'j')

Try it online!

Edit Thanks to @LegionMammal978 and @Kevin for saving 2 bytes

\$\endgroup\$
7
  • 5
    \$\begingroup\$ Just curious, why do you include a semicolon on the end of your lambda? \$\endgroup\$ Commented Aug 26, 2018 at 22:27
  • 1
    \$\begingroup\$ In addition to what @LegionMammal978 mentioned (trailing semi-colons doesn't have to be counted in the byte-count for Java/C# lambdas), by taking an unused empty parameter you can golf the ()=> to o=> for an additional -1 byte. \$\endgroup\$ Commented Aug 28, 2018 at 7:38
  • 2
    \$\begingroup\$ Indeed, with both @Kevin's and my advice, the lambda can be golfed to o=>"$"+('t'<<'j') with $118784. \$\endgroup\$ Commented Aug 28, 2018 at 10:30
  • \$\begingroup\$ @Kevin I didn't know about this, thanks for the info. \$\endgroup\$
    – pmysl
    Commented Aug 28, 2018 at 14:23
  • \$\begingroup\$ @LegionMammal978 Thanks for pointing out unnecessary semicolon and for providing updated lambda. I must have overlooked this semicolon somehow \$\endgroup\$
    – pmysl
    Commented Aug 28, 2018 at 17:20
11
\$\begingroup\$

PHP, 13 Bytes, $144000 Salary

Unfortunately for this job, moving to Mauritius is required (well, I could move slightly less far eastward, however every timezone less would yield at $36k drop in salary.) To compensate for the inconvenience, my salary increases by $1 every leap year.

$<?=date(ZL);

This just puts out Z the timezone in seconds and appends whether or not it's a leap year.

\$\endgroup\$
11
\$\begingroup\$

brainfuck, 43 bytes, $58888

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

Try it online!

How it works

++++++[>++++++<-]>.  write 36 to cell one and print (36 is ASCII for $)

<++++[>++++<-]>+.    add 17 to cell 1 and print (cell 1 is now 53, ASCII for 5) 

+++....              add 3 to cell 1 and print 4 times (cell 1 is now 56, ASCII for 8)
\$\endgroup\$
1
  • 1
    \$\begingroup\$ Welcome to PPCG! Hope you stick around \$\endgroup\$
    – Jo King
    Commented Aug 28, 2018 at 23:33
10
\$\begingroup\$

Python 3, (22 bytes) $ 98,442

print('$',ord('𘂊'))

Try it online!

Much like Doorknob's Ruby answer, the 4 byte Unicode character used here, 𘂊, has an ordinal value of the maximal integer salary achievable in 22 bytes.

Note that print() prints its unnamed arguments separated by spaces by default (sep is an optional named argument).

\$\endgroup\$
3
  • \$\begingroup\$ you can do slightly better than that using f strings: print(f"${ord('𘫿')}") is 21 bytes and outputs $101119 \$\endgroup\$
    – Matt
    Commented Aug 28, 2018 at 14:33
  • 2
    \$\begingroup\$ @Matt that is 24 bytes (I thought of f-string but realised that the extra braces would cost 2 bytes) \$\endgroup\$ Commented Aug 28, 2018 at 15:39
  • 2
    \$\begingroup\$ Proof that Python 2 will earn a higher salary. \$\endgroup\$
    – mbomb007
    Commented May 29, 2019 at 13:56
9
\$\begingroup\$

Gol><>, $207680 in 8 bytes

'o**n; $

Try it online!

How it works:

'        Start string interpretation. Pushes the ASCII value of every character until it wraps back around to this character
 o       Output the top stack value as ASCII. This is the $ at the end of the code
  **     Multiply the top 3 stack values (This is the ASCII of 'n; ', 110*59*32
    n    Output top of stack as integer.
     ;   Terminate program
       $ (Not run, used for printing the $)

Interestingly enough, you can use h instead of n;, which yields 'o**h5$ with a score of $231504, but you can't use 0-9, and there isn't another 1-byte way to push 53, the ASCII value of 5

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Welcome to PPCG! \$\endgroup\$
    – user45941
    Commented Aug 28, 2018 at 0:56
8
\$\begingroup\$

Mathematica, 18 bytes, $107,163.49

$~Print~N[E^(E!E)]

Full program; run using MathematicaScipt -script. Outputs $107163.4882807548 followed by a trailing newline. I have verified that this is the highest-scoring solution of the form $~Print~N[expr] where expr is comprised of Pi, E, I, and +-* /()!.

\$\endgroup\$
6
  • \$\begingroup\$ What about I? \$\endgroup\$
    – DELETE_ME
    Commented Aug 26, 2018 at 4:40
  • \$\begingroup\$ @user202729 Nope, doesn't help; any number that actually uses I and not just I I or I/I will generally have a + 0.*I tacked onto its N. \$\endgroup\$ Commented Aug 26, 2018 at 10:22
  • \$\begingroup\$ Very nice! I had gotten as far as "$"~Print~Exp[E!N@E] (which is the same length as "$"~Print~N[E^(E!E)]), but with the quotation marks around $, the output was just barely over the limit. \$\endgroup\$ Commented Aug 26, 2018 at 14:37
  • \$\begingroup\$ What I came up with was Print[$,N[Pi^(Pi*Pi)]], giving $80662.7. I tried various combinations of Pi, E, +, *, ^ (thought about I but didn't see any effective way to use it), but it never occurred to me to try !. \$\endgroup\$ Commented Aug 30, 2018 at 1:00
  • \$\begingroup\$ $~Print~⌈E^(E!E)⌉ with left and right ceiling characters with one character it would be little bit more and 17 bytes \$\endgroup\$
    – buttercrab
    Commented Feb 9, 2019 at 14:19
8
\$\begingroup\$

05AB1E (5 bytes), $262626

'$₂ÐJ

Try it online!

\$262626 < 299069\$. Pushes the character $ to the stack, then pushes the integer \$26\$. From here, the program triplicates the integer, leaving the stack as ["$", 26, 26, 26] and joins (J) the stack.

\$\endgroup\$
8
\$\begingroup\$

JavaScript (Node.js), 23 bytes, $65535

_=>"$"+ +(~~[]+`xFFFF`)

Try it online!

This is the best I can get without atob, though there is a large improvement space tbh

You know, having no short character to ascii conversion function sucks A LOT.

AFTER A WHOLE DAY

JavaScript (Node.js), 30 bytes, $78011

_=>"$"+`𓂻`.codePointAt(![])

Try it online!

or: 29 bytes, $80020

_=>"$"+`򀀠`.codePointAt(!_)

Where 򀀠 is U+13894 INVALID CHARACTER

Oh String.codePointAt! I've just completely forgotten this!

A joke one (15B, $130000), not vaild at all but just for fun

_=>"$十三萬"
\$\endgroup\$
7
  • \$\begingroup\$ So, why not _=>"$⑮萬" ^_^ \$\endgroup\$
    – tsh
    Commented Aug 26, 2018 at 7:36
  • 3
    \$\begingroup\$ I'm laughing right now because I can understand the Chinese... \$\endgroup\$
    – ericw31415
    Commented Aug 30, 2018 at 21:23
  • \$\begingroup\$ How about x1683F? \$\endgroup\$ Commented Oct 3, 2018 at 7:35
  • \$\begingroup\$ Simply using _=>"$"+parseInt('1V0I',36) is also higher than what you have so far, so you might want to add that one too. Too bad you can't convert base 64 to decimal in JavaScript... \$\endgroup\$ Commented Oct 3, 2018 at 7:53
  • \$\begingroup\$ @GustVanDeWal sadly you cannot use digits in the code. \$\endgroup\$ Commented Oct 3, 2018 at 8:43
6
\$\begingroup\$

Jelly, 8 bytes, $210176.48625619375

⁽½"×½”$,

3535 (⁽½") multipli(×)ed by its sqrt (½).

Try it online!

\$\endgroup\$
6
\$\begingroup\$

Perl 5.26.2, 12 bytes, $146002

say$]^"\x11\x0e\x01\x06"

Hex escapes only shown because ASCII control chars are filtered out.

Try it online!

You can get a bit more with different Perl versions, for example $155012 with 5.25.12.

\$\endgroup\$
4
  • \$\begingroup\$ Where's the dollar sign? \$\endgroup\$
    – Zaid
    Commented Sep 2, 2018 at 19:44
  • 1
    \$\begingroup\$ @Zaid The dollar sign comes XORing 0x35 (ASCII char 5 from the Perl version string in $]) with 0x11, resulting in 0x24 (ASCII char $). \$\endgroup\$
    – nwellnhof
    Commented Sep 3, 2018 at 0:55
  • \$\begingroup\$ Wait, this source does contain numbers — namely 0, 1, 6. \$\endgroup\$ Commented Sep 13, 2018 at 0:42
  • \$\begingroup\$ @hidefromkgb Hex escapes like \x11 are ASCII control chars in the actual code. Have a look at the TIO link. \$\endgroup\$
    – nwellnhof
    Commented Sep 13, 2018 at 12:22
6
\$\begingroup\$

MATLAB, 17 bytes, $112222

['$','..////'+pi]

Old answer:

['$','RRUUTR'-'!']
\$\endgroup\$
2
  • 1
    \$\begingroup\$ nice one to use the automatic conversion of the ascii code thanks to the +pi \$\endgroup\$
    – Hoki
    Commented Aug 30, 2018 at 10:05
  • \$\begingroup\$ e is not a builtin constant in matlab \$\endgroup\$ Commented Sep 24, 2018 at 0:05
6
\$\begingroup\$

brainfuck, 34 bytes, $69999

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

Try it online!

Explanation:

+[->-[---<]>-]>.   Generate and print 36 ($)
[-->+++<]>         Divide by 2 and multiply by 3 to get 54 (6)
          .        Print 6
           +++.... Print 9999
\$\endgroup\$
6
\$\begingroup\$

Ruby, $119443

$><<?$<<?𝊓.ord

Try it online!

The maximum integer output for 17 bytes. The Unicode character is U+1D293, which is 119443 in hex.

\$\endgroup\$
2
  • \$\begingroup\$ If you want to take a chance, try the 10 byte $><<?$<<$$ on a long-running system. Answers up to 177827 are valid. \$\endgroup\$
    – AShelly
    Commented Sep 1, 2018 at 0:48
  • \$\begingroup\$ I think you mean "in decimal," or at least there's some ambiguity. \$\endgroup\$
    – jpmc26
    Commented Sep 1, 2018 at 2:08
6
\$\begingroup\$

MathGolf, $353535 (4 bytes)

'$W∙

Try it online!

Explanation

'$    Push "$"
  W   Push 35
   ∙  Triplicate top of stack

Disclaimer

This language was created after the posting of this question. While the language is a general language, it is designed with numerical questions in mind. It contains a lot of 1-byte number literals, and other nifty things for number-related questions. It is still a work in progress.

\$\endgroup\$
0
5
\$\begingroup\$

dc, $169169 10 bytes

Dd*d[$]nnn

Try it online!

This prints 13 (D) squared, twice

\$\endgroup\$
0
5
\$\begingroup\$

Japt, 5 bytes, $262144

'$+I³

Test it


Explanation I is the Japt constant for 64, ³ cubes it and then '$+ concatenates that with the dollar symbol.

\$\endgroup\$
1
  • \$\begingroup\$ Glad I checked first. I was about to post "${I³ \$\endgroup\$
    – Oliver
    Commented Feb 4, 2019 at 21:53
1
2 3 4 5

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