228
\$\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\$
  • 61
    \$\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 '18 at 0:45
  • 2
    \$\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 '18 at 19:07
  • 6
    \$\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\$ – ETHproductions Aug 27 '18 at 19:27
  • 9
    \$\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\$ – Shieru Asakoto Aug 28 '18 at 11:21
  • 2
    \$\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\$ – Shieru Asakoto Feb 8 at 8:22

115 Answers 115

5
\$\begingroup\$

Excel VBA - 22 Bytes, $97336

?"$"&Asc(".")^Asc("")

How it works

? - Print in immediate
 "$" - $ character
 asc(".") = 46
 Asc("") = 3
  46 ^ 3 = 97336
\$\endgroup\$
  • \$\begingroup\$ A good first post! You can drop an extra byte by removing the &, but this doesn't open up any useable higher salaries via this method - only 10^5 = 100,000, which would require a line-feed, and then can't be typed in the immediate window (vbLf would take you over the character limit) \$\endgroup\$ – Chronocidal Aug 28 '18 at 14:41
  • \$\begingroup\$ This a great first post, but it is worth noting that it only works in 32-Bit Versions of Excel, as in 64-Bit Versions, the ^ character plays double duty as both the exponentiation and longlong type declaration character \$\endgroup\$ – Taylor Scott Feb 15 at 19:30
5
\$\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\$
4
\$\begingroup\$

Jelly, 5 bytes, $256'256

”$¹⁹⁹

Try it online!

How it works

”$¹⁹⁹  Main link. No arguments.

”$     Set the left argument and the return value to '$'.
  ¹    Apply the identity function. This allows implicit printing.
   ⁹   Set the return value to 256.
       Since this discards the previous return value ('$'), it is printed implicitly.
    ⁹  Set the return value to 256.
       Since this discards the previous return value (256), it is printed implicitly.
       (implicit) Print the last return value (256).
\$\endgroup\$
4
\$\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\$
  • \$\begingroup\$ Where's the dollar sign? \$\endgroup\$ – Zaid Sep 2 '18 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 Sep 3 '18 at 0:55
  • \$\begingroup\$ Wait, this source does contain numbers — namely 0, 1, 6. \$\endgroup\$ – hidefromkgb Sep 13 '18 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 Sep 13 '18 at 12:22
4
\$\begingroup\$

Perl 6, 11 bytes, $165,000 10 bytes, $177,147 12 bytes, $150,000

'$'~㉝*ↁ

'$'~۳¹¹

{'$'~۳*ↇ}

Try it online!

The Unicode characters ㉝ (CIRCLED NUMBER THIRTY THREE) and ↁ (ROMAN NUMERAL FIVE THOUSAND) conveniently evaluate to their Unicode values in numeric expressions.

۳ is the Unicode character EXTENDED ARABIC-INDIC DIGIT THREE, which conveniently evaluates to its Unicode value of 3 in numeric expressions. That 3 is raised to the eleventh power by following it with two superscript ones.

\$\endgroup\$
  • \$\begingroup\$ What about just 20000? Try it online! \$\endgroup\$ – Jo King Aug 26 '18 at 0:33
  • 2
    \$\begingroup\$ Actually though, I think this is just a snippet, so you should make it a function or a full program. 162754 \$\endgroup\$ – Jo King Aug 26 '18 at 0:43
  • \$\begingroup\$ @JoKing Clearly I didn't search enough of the Unicode space to find that 200,000. As for being a snippet, the question asked for "output," which I think can reasonably mean the result of evaluating an expression. Also, at the time I answered, there were several other responses which were just expressions. \$\endgroup\$ – Sean Aug 27 '18 at 18:24
  • \$\begingroup\$ But since it's hardly a big deal... \$\endgroup\$ – Sean Aug 27 '18 at 19:17
  • 1
    \$\begingroup\$ 162754 \$\endgroup\$ – Jo King Aug 27 '18 at 21:08
4
\$\begingroup\$

PHP, 18 bytes, $114431

This was actually a very quick challenge, but fun!

$<?=ppuurp^AAAAAA;

Simply writes $114431 (excluding the warnings).

Tricks I've used:

  • PHP will output anything outside it's opening and closing tag (saves 3 bytes vs '$'.[...])
  • The opening tag <?= has the same effect as <?php echo [....]; (saves 8 bytes)
  • You don't need to use quotes for "strings" that don't have spaces or start with numbers.
    This makes it so PHP parses it as a constant.
    Non-existing constants are converted to string (ex. AAAAAA is the same as "AAAAAA").
    (saves 4 bytes - 2 bytes per "string")
  • You don't really need the closing tag, and PHP advices you to not include it if it is a page that shouldn't have output.
    (Check https://stackoverflow.com/a/19953547/2729937 for more).
\$\endgroup\$
4
\$\begingroup\$

Swift, $131072 (13 bytes)

"$\(MAXPHYS)"

In Swift Playground it prints "$131072"

\$\endgroup\$
4
\$\begingroup\$

APL $130189.4947846055 (18 15 bytes, 10 9 characters)

Thanks to @Ross Presser for pointing out the byte length and for saving a character. Byte length determined using Python's len function.

'$',!○*≡⍬
=> $ 130189.4947846055

Can be run on repl or offline if you have an APL interpreter e.g. NodeJS + NGN APL.

The maximum for the length is $177827.9.

How it works

is the empty vector and the single argument form of obtains the depth of the argument (number of nested arrays, effectively). This can be used to obtain the number 1 in order to perform further math operations, as a vector containing only scalars (or nothing at all) has depth 1.

!○* are the factorial, pi times X, and e^x functions, respectively. APL operates right-to-left, so the value 1 is passed to these functions RTL and this expression computes (pi * e)!.

Then the dollar sign must be prepended by concatenating (,) the string value with the computed value.

Note: I did this mostly by trial and error. Often, using exponentiation after multiplication resulted in values that were way too large for the byte count. There might be a more optimal combination of operators.

\$\endgroup\$
  • 1
    \$\begingroup\$ here's a permalink for your answer (although it only evaluates as an integer, which loses you 49 cents). "10 bytes" is only accurate if you are using IBM Codepage 907. \$\endgroup\$ – Ross Presser Sep 4 '18 at 10:23
  • 1
    \$\begingroup\$ And you can save a byte by doing simply ≡⍬ instead of ⍬≡⍬ \$\endgroup\$ – Ross Presser Sep 4 '18 at 10:28
4
\$\begingroup\$

PowerShell 5.1, $77126 $85184 $101101 $105105, 25 21 20 Bytes

"$"+($x=+'i'[""])+$x

or

+'i'['']|%{"$ $_$_"}

or

$x=+'i'[''];"`$$x$x"

+10k thanks to AdmBorkBork
+16k thanks to Mazzy
+4k thanks to Mazzy again
+2 solutions thanks to Mazzy, the absolute Maddest Lad

With a little help, we hit the 100k mark. We have "i" index into itself to do some cheeky casting and then concats that to itself.

\$\endgroup\$
  • 1
    \$\begingroup\$ You can golf some bytes (and thus improve the salary) using + instead of [int] like follows -- "`$$(+[char]"C")"+(+[char]'~') \$\endgroup\$ – AdmBorkBork Aug 28 '18 at 14:54
  • 1
    \$\begingroup\$ Take it: "$"+($x=+'e'[+$i])+$x, $101101, 21 bytes. You should start the script on a clear Powershell with Set-StrictMode -Off (default mode). If $i have defined then clear the var by command rv i \$\endgroup\$ – mazzy Sep 13 '18 at 0:38
  • 1
    \$\begingroup\$ Enjoy the bonus: "$"+($x=+'i'[""])+$x, $105105, 20 bytes \$\endgroup\$ – mazzy Sep 13 '18 at 11:17
  • 1
    \$\begingroup\$ One more 20 bytes :) $x=+'i'[''];"``$$x$x". Note double ` used for comment on stackexchange only. Replace double ` on single one or use allowed space $x=+'i'[''];"$ $x$x". \$\endgroup\$ – mazzy Sep 14 '18 at 7:48
  • 1
    \$\begingroup\$ Newerending story... +'i'['']|%{"$ $_$_"} with Scrooge McDuck emoji string $ $_$_ \$\endgroup\$ – mazzy Sep 14 '18 at 8:17
4
\$\begingroup\$

T-SQL, $65,025 $72,614 (33 bytes)

PRINT CONCAT('$',CHECKSUM('
ßÝ'))                                       --  $72614,   33 bytes

Just in case that doesn't display or copy correctly, the string is CHAR(10) + CHAR(223) + CHAR(221), so does not contain any multi-byte characters.

I've verified CHECKSUM produces this same result in both SQL 2017 and SQL 2012; it is unlikely but possible that other versions might produce different values (since the exact CHECKSUM mechanism is unpublished).

To find this I had to evaluate the CHECKSUM of all possible 3-character strings from CHAR(9) (tab) to CHAR(255). Good thing that's easy enough to do in SQL with a self-join from a number table.

Some of my prior attempts:

PRINT CONCAT('$',CHECKSUM(']èÆ'))           --  $72562,   33 bytes
PRINT CONCAT('$',SQUARE(ASCII('ÿ')))        --  $65025,   36 bytes
PRINT CONCAT('$',PI()*EXP(PI()*PI()))       --  $60738.6, 37 bytes

Note that any of these can alternately be written, with no loss of bytes, as:

PRINT FORMAT(CHECKSUM(']èÆ'),'C')           --  $72,562.00  33 bytes

The latter has a more nicely formatted output, but it is unclear whether the comma is allowed by the rules.

\$\endgroup\$
3
\$\begingroup\$

Hexagony, 12 bytes, $122122

D{y@!!<'*;z/

Try it online!

\$\endgroup\$
3
\$\begingroup\$

><>, 8 bytes, $210196

'o+n+|V$

Try it online!

Explanation:

'         Push the rest of the code to the stack
 o        Print the $
  +n      Add the top two and print as a number (210)
   n+|    Add the top three and print as a number (196)
 o+       Error as the stack runs out
\$\endgroup\$
3
\$\begingroup\$

Pascal (FPC), $72089

33 bytes

begin write('$',$AFFFF div$A)end.

Try it online!

Found by playing with arithmetics and hexadecimal constants. See below for more interesting answers.


Pascal (FPC), $65526

37 bytes

var x:word=-$A;begin write('$',x)end.

Try it online!

Thanks to @JonathanAllan for reminding me of initialization in declaration, it shortened my new approach.

No way Brain-Flak programmer can have bigger salary!

$A is hexadecimal constant 10. Variables of type word have values in range 0..65535, so initializing it with -10 gives 65526 instead (and a range check warning).


Pascal (FPC), $54872

47 bytes

begin write('$',ord('&')*ord('&')*ord('&'))end.

Try it online!

\$\endgroup\$
  • 1
    \$\begingroup\$ var x:byte=ord('&');begin write('$',x*x*x)end. saves a byte, but does not increase salary. \$\endgroup\$ – Jonathan Allan Aug 25 '18 at 17:31
3
\$\begingroup\$

Bubblegum, $260847 (6 bytes)

00000000: 03b3 c759 0bf8                           ...Y..

Try it online!

\$\endgroup\$
3
\$\begingroup\$

><>, 7 bytes, $232110

'onnè$

Try it online!

Explanation (simple):

'onnè$
'      : Start putting chars onto the stack.
 o     : Print the stack top
  nn   : Print the stack top as numbers
    è$ : Errors the program
\$\endgroup\$
3
\$\begingroup\$

Haskell, $99999 (15 bytes)

pred<$>"%:::::"

Try it online!

\$\endgroup\$
3
\$\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\$
3
\$\begingroup\$

Keg, $298298 (5 Bytes)

\$Ī:

Fixed my answer now so it actually fits within the rules. Ī is two bytes so this is very close to the max I can get for this byte count.

How it works

\$   Pushes $ to the stack, has to be escaped since $ is the swap instruction in Keg
Ī  Pushes the unicode value of this character, which is 298
:  Duplicates the top value of the stack, which is 298
End of programme prints entire stack, resulting in $298298
\$\endgroup\$
  • \$\begingroup\$ Ok, fixed all problems with it now \$\endgroup\$ – EdgyNerd Aug 8 at 5:59
  • \$\begingroup\$ Oh, I was using Ī since it's Unicode value is 298, and not because it's an instruction. Also, any number above 255 is outputted as a number instead of a character, so it doesn't seem like undocumented behaviour \$\endgroup\$ – EdgyNerd Aug 10 at 9:20
  • 1
    \$\begingroup\$ +1 for clever use of Unicode characters. \$\endgroup\$ – A̲̲ Aug 10 at 9:24
  • \$\begingroup\$ Hey @EdgyNerd, you are right about numbers greater than 255 being printed as integers not being undocumented behaviour: when creating the implicit output system, I wanted it to print only ASCII characters in the range of 10 to 255. Why? Because I had no clue people would be using Unicode characters. But also, I think it is unique as well. \$\endgroup\$ – Jono 2906 Aug 10 at 11:59
  • \$\begingroup\$ yeah, using Unicode character allows you to represent large number using very little bytes, and, as you said, I don't think any other lang has a feature like that \$\endgroup\$ – EdgyNerd Aug 10 at 12:20
2
\$\begingroup\$

Brain-Flak, $55555

([(((()()()()){}){}())](((((({})({}()){}))))))

Try it online!

Brain-Flak with -r flag, $57777

((((((((()()()()){}){}())(({}()){}))()()))))

Try it online!

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

gvm (commit 2612106) bytecode, 7 bytes ($232255)

░$áΦá └

program shown in cp 437 encoding. It seems I can't paste a non-breaking space correctly here :( (ff in cp-437, U+00a0 in unicode) -- the space in the code should be one.

Output:

> ./gvm salary.bin
$232255

Hexdump:

> hexdump -C salary.bin
00000000  b0 24 a0 e8 a0 ff c0                              |.$.....|
00000007

Disassembled:

c:0100  b0 24       WCH #'$'    ; write character $
c:0102  a0 e8       WUD #$e8    ; write unsigned byte $e8 (232)
c:0104  a0 ff       WUD #$ff    ; write unsigned byte $ff (255)
c:0106  c0          HLT         ; terminate

This is a pre-alpha version of a virtual machine I'm working on -- hope this is still allowed, the commit that correctly executes this code is from yesterday :)

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

Charcoal, 6 bytes, $252525

$׳I²⁵

Try it online! Link is to verbose version of code. Works by casting the numeric constant 25 to string and repeating it 3 times. The best Charcoal can do in 5 bytes is $222222:

$×⁶I²

Try it online! Link is to verbose version of code.

\$\endgroup\$
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\$
  • 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 '18 at 17:57
  • \$\begingroup\$ @Shaggy didnt notice, couldnt get 232256 though \$\endgroup\$ – Luis felipe De jesus Munoz Aug 25 '18 at 19:43
  • \$\begingroup\$ Sorry, that was a typo; should've been 232255. \$\endgroup\$ – Shaggy Aug 25 '18 at 19:47
  • \$\begingroup\$ @Shaggy The byte count is correct in Japt’s native ISO-8859-1 encoding. \$\endgroup\$ – Anders Kaseorg Aug 29 '18 at 23:44
2
\$\begingroup\$

Java

program, 73 bytes, $40033 (of max 40041.67)

interface G{static void main(String[]a){System.out.print("$"+'+'*'Σ');}}

Explanation

It uses the product of the ascii character + (43) with the greek unicode character Σ (931).

Lambda, 35 bytes, $69388 (of max 69494.27)

()->System.out.print("$"+'L'*'Α');
\$\endgroup\$
  • \$\begingroup\$ It shouldn't change your solution much, but the required format is dollar sign first, then value \$\endgroup\$ – Nicola Sap Aug 25 '18 at 20:53
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
    \$\begingroup\$ Challenge said no input... Nice language, still. \$\endgroup\$ – Stéphane Gourichon Aug 26 '18 at 7:19
  • \$\begingroup\$ @StéphaneGourichon Oh shoot! :\ \$\endgroup\$ – Draco18s Aug 26 '18 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\$ – Draco18s Aug 29 '18 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\$
  • \$\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\$ – Kevin Cruijssen Aug 27 '18 at 20:46
  • \$\begingroup\$ @KevinCruijssen just did that, thanks! \$\endgroup\$ – J. Sallé Aug 27 '18 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 '18 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\$
  • \$\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 '18 at 6:21
  • 1
    \$\begingroup\$ 6 dollars off the max \$\endgroup\$ – Jo King Aug 28 '18 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\$

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.