Without using numbers, get the highest salary you can. But don't exaggerate!

229

33

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

Nicola Sap

Posted 6 years ago

Reputation: 2 291

61This is one of the very few (imo) successful non-fixed-output no-input non-random challenge. Unique idea! – Mr. Xcoder – 6 years ago

would $ 119 126 be valid output? – ovs – 6 years ago

@ovs not according to the rules, no. sorry – Nicola Sap – 6 years ago

2Nice 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. – BradC – 6 years ago

6

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!

– ETHproductions – 6 years ago

9Just 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 ;) – Shieru Asakoto – 6 years ago

Congratulations on acquiring 2 gold badges! – Jonathan Allan – 6 years ago

2

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.

– Shieru Asakoto – 6 years ago

Answers

109

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.

Doorknob

Posted 6 years ago

Reputation: 68 138

55Funnily 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! – numbermaniac – 6 years ago

13Use ] instead of x, the former is less likely to exist. – pts – 6 years ago

@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! – val says Reinstate Monica – 6 years ago

67

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.

Kevin Cruijssen

Posted 6 years ago

Reputation: 67 575

12Dang, impressively efficient score! – ETHproductions – 6 years ago

43

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.

Dennis

Posted 6 years ago

Reputation: 196 637

42

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.

maxb

Posted 6 years ago

Reputation: 5 754

6Since your score is your salary, you should mention it in the header. This answer is currently winning. :) – Dennis – 6 years ago

37

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......

Giuseppe

Posted 6 years ago

Reputation: 21 077

2might 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. – JayCe – 6 years ago

29

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

Jonathan Allan

Posted 6 years ago

Reputation: 67 804

1That's 11 bytes, even if it is 5 characters. – dotancohen – 6 years ago

3@dotancohen: 0x0724011d41 is 5 bytes by my count... – eggyal – 6 years ago

2@eggyal: I missed the bit about code-page 437. Nice touch! – dotancohen – 6 years ago

3Dear down-voter, could I have some feedback please; I don't see what is incorrect, not useful, or unclear. – Jonathan Allan – 6 years ago

27

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.

JayCe

Posted 6 years ago

Reputation: 2 655

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. – Giuseppe – 6 years ago

@Giuseppe I'm just trying prod and sum randomly... but prod increases too fast ! – JayCe – 6 years ago

sum(volcano) is 690907 but that would have to be about 1 byte to work, haha – Giuseppe – 6 years ago

Great idea using datasets ! – digEmAll – 6 years ago

@Giuseppe good catch I had completely overlooked that! duh. – JayCe – 6 years ago

@digEmAll another thing would be the quantile functions for common distributions...but I have not found a way to do it golfily. might not be such a good idea. – JayCe – 6 years ago

Other usable functions include sd and var but I did a quick brute force search on all the datasets and I didn't find any interesting "value"... but surely I missed something. The problem here is that cat("$",) leave us with 10 free characters at most, so a lot of datasets are unusable :( – digEmAll – 6 years ago

@digEmAll Perhaps max? – Giuseppe – 6 years ago

I tried also max/min, but no single value is near 100K :( ... Another approach could be concatenating two numbers in cat, but that would require sep='' which takes other bytes... – digEmAll – 6 years ago

You can try ^pi or *pi combined with sum, min, max for 3 lette dataset @digEmAll – JayCe – 6 years ago

There is only 1 letter dataset lh, and four 3-letters : BOD,co2,CO2,npk but 2 of them have numbers in the name. Also, npk contains factors so sum/max etc does not work. For BOD and lh I couldn't find any useful combination. (PS: probaly you know it but you can get all datasets names using ls("package:datasets") ) – digEmAll – 6 years ago

@digEmAll is there a way to print only the first decimal digits of pi (excluding 3)? – JayCe – 6 years ago

@JayCe: mmh, I'm not aware of any function doing that... – digEmAll – 6 years ago

@digEmAll asking as I am really bad at sprintf, formatC, etc... I tried several ways but none worked – JayCe – 6 years ago

Let us continue this discussion in chat.

– digEmAll – 6 years ago

26

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).

Arnauld

Posted 6 years ago

Reputation: 111 334

Wow Buffer. First time ever to acknowledge this class ;') – Shieru Asakoto – 6 years ago

1

@user71546 It could be done in 24 bytes for $91,126 if thousand separators were allowed. But apparently, they're not... :(

– Arnauld – 6 years ago

Buffer constructor is deprecated, so that will get longer in future versions – mcfedr – 6 years ago

@mcfedr We don't care for code golf, as long as a working version of the interpreter is properly specified. – Riking – 6 years ago

25

Self-modifying Brainfuck, 16 bytes, $124444

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

Try it online!

user202729

Posted 6 years ago

Reputation: 14 620

1You didn't end up using the :, so you can remove it and add another + for $124444. – Nitrodon – 6 years ago

@Nitrodon Ah right, thanks. – user202729 – 6 years ago

After printing the 1, why not count to 3 and then print only 3s? You would save a byte and print a higher number. – 12431234123412341234123 – 6 years ago

@12431234123412341234123 You'd need to save two bytes. Otherwise, with 15 bytes, you're only allowed up to 131199,133333 is too much. – hvd – 6 years ago

21

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!

mschuett

Posted 6 years ago

Reputation: 311

1Ha I’ll switch it out for something else tomorrow – mschuett – 6 years ago

4Instead of <?="$"., just do $<?= and save a few bytes. – Ismael Miguel – 6 years ago

2@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. – mschuett – 6 years ago

That is quite a nice constant! Really wasn't aware of it. Also, it is usual to leave the old version, so people can still see it. But it is fine, you did a nice job! – Ismael Miguel – 6 years ago

@Arnauld thanks! I updated the link :) – mschuett – 6 years ago

Note that you can click on the 'Link' button in TIO and select 'Markdown' to get a link that can be pasted right away within the submission. Or even 'Code Golf submission' for a full TIO-based answer. Nice first answer, BTW! – Arnauld – 6 years ago

1wow didnt knew about this constant, but I couldnt find in docs, can any one help on this? – Rafee – 6 years ago

3

@Rafee it's actually not documented any place that I can find. It's a language constant that was added 17 years ago https://github.com/php/php-src/commit/f1364ebf3ead89f145af573e3b90f3503898b0ad. 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 https://www.gnu.org/software/libc/manual/pdf/libc.pdf on page 195.

– mschuett – 6 years ago

1I think that ERA might be for the Japanese Emperor era data, which is about to change at Q2 next year. The D_T/D/T format constants seem to suggest that. – Riking – 6 years ago

17

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.

Dennis

Posted 6 years ago

Reputation: 196 637

17

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

Keeta - reinstate Monica

Posted 6 years ago

Reputation: 938

2Welcome to PPCG! – Luis felipe De jesus Munoz – 6 years ago

6+1 Even better, they'll be impressed with your Excel skills and want you to be an account manager. – theREALyumdub – 6 years ago

2@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 ;) – Aaron – 6 years ago

I'd argue with Excel's accounting formatting, that you can skip the $ entirely, and simply set the formatting to accounting. – Selkie – 6 years ago

@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() for125773, or 17 characters (adding 2 for the the format letters) with =CODE(")")^PI() for $116603, or if this is disallowed. – Keeta - reinstate Monica – 6 years ago

12

Jelly,  256000256256  (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 '$')

Jonathan Allan

Posted 6 years ago

Reputation: 67 804

1That looks like 5 characters, but 11 bytes. – dotancohen – 6 years ago

9

@dotancohen Jelly uses a custom code page.

– Carmeister – 6 years ago

@Carmeister:Nice! – dotancohen – 6 years ago

$256512 – NieDzejkob – 6 years ago

@NieDzejkob indeed 6 bytes are available - I have $257256 now :) – Jonathan Allan – 6 years ago

12

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.

Doorknob

Posted 6 years ago

Reputation: 68 138

11

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

pmysl

Posted 6 years ago

Reputation: 111

5Just curious, why do you include a semicolon on the end of your lambda? – LegionMammal978 – 6 years ago

1

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.

– Kevin Cruijssen – 6 years ago

2Indeed, with both @Kevin's and my advice, the lambda can be golfed to o=>"$"+('t'<<'j') with $118784. – LegionMammal978 – 6 years ago

@Kevin I didn't know about this, thanks for the info. – pmysl – 6 years ago

@LegionMammal978 Thanks for pointing out unnecessary semicolon and for providing updated lambda. I must have overlooked this semicolon somehow – pmysl – 6 years ago

However the question says it should take no input. – ev3commander – 6 years ago

"{'T'<<'i'}" would be equivalent also – PmanAce – 6 years ago

10

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 36kdropinsalary.)Tocompensatefortheinconvenience,mysalaryincreasesby1 every leap year.

$<?=date(ZL);

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

aslum

Posted 6 years ago

Reputation: 251

9

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)

Prismo

Posted 6 years ago

Reputation: 121

1Welcome to PPCG! Hope you stick around – Jo King – 6 years ago

8

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).

Jonathan Allan

Posted 6 years ago

Reputation: 67 804

you can do slightly better than that using f strings: print(f"ord(101119 – Matt – 6 years ago

2@Matt that is 24 bytes (I thought of f-string but realised that the extra braces would cost 2 bytes) – Jonathan Allan – 6 years ago

Proof that Python 2 will earn a higher salary. – mbomb007 – 6 years ago

8

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

xornob

Posted 6 years ago

Reputation: 181

1Welcome to PPCG! – Mego – 6 years ago

6

Jelly, 8 bytes, $210176.48625619375

⁽½"×½”$,

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

Try it online!

user202729

Posted 6 years ago

Reputation: 14 620

6

Ruby, $119443

$><<?$<<?.ord

Try it online!

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

Doorknob

Posted 6 years ago

Reputation: 68 138

If you want to take a chance, try the 10 byte $><<?$<<$$ on a long-running system. Answers up to 177827 are valid. – AShelly – 6 years ago

I think you mean "in decimal," or at least there's some ambiguity. – jpmc26 – 6 years ago

6

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.

Mr. Xcoder

Posted 6 years ago

Reputation: 39 774

6

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 +-* /()!.

LegionMammal978

Posted 6 years ago

Reputation: 15 731

What about I? – user202729 – 6 years ago

@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. – LegionMammal978 – 6 years ago

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. – Misha Lavrov – 6 years ago

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 !. – Meni Rosenfeld – 6 years ago

$~Print~⌈E^(E!E)⌉ with left and right ceiling characters with one character it would be little bit more and 17 bytes – buttercrab – 6 years ago

@jaeyongsung Since and are respectively U+2308 and U+2309, your code would take 21 UTF-8 bytes or 34 UTF-16 bytes. – LegionMammal978 – 6 years ago

6

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

_=>"$十三萬"

Shieru Asakoto

Posted 6 years ago

Reputation: 4 445

So, why not _=>"$⑮萬" ^_^ – tsh – 6 years ago

2I'm laughing right now because I can understand the Chinese... – ericw31415 – 6 years ago

How about x1683F? – Gust van de Wal – 6 years ago

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... – Gust van de Wal – 6 years ago

@GustVanDeWal sadly you cannot use digits in the code. – Shieru Asakoto – 6 years ago

Whoops! Seems like I had too little sleep :) – Gust van de Wal – 6 years ago

6

MATLAB, 17 bytes, $112222

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

Old answer:

['$','RRUUTR'-'!']

Max Radin

Posted 6 years ago

Reputation: 161

1nice one to use the automatic conversion of the ascii code thanks to the +pi – Hoki – 6 years ago

e is not a builtin constant in matlab – Majestas 32 – 6 years ago

5

dc, $169169 10 bytes

Dd*d[$]nnn

Try it online!

This prints 13 (D) squared, twice

H.PWiz

Posted 6 years ago

Reputation: 10 962

5

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.

Shaggy

Posted 6 years ago

Reputation: 24 623

Glad I checked first. I was about to post "${I³

– Oliver – 6 years ago

5

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

Jo King

Posted 6 years ago

Reputation: 38 234

5

Befunge-93, 9 bytes, $192448

a>$",**.@

Try it online!

Outputs $192448, just two dollars and nine cents short of the maximum. This even works as a polyglot with proper implementations of Befunge-98, where it doesn't even have to throw up an unrecognised instruction error!

Explanation:

a>$        Basically no-ops
   "       Wrapping string that pushes the code and a lot of spaces to the stack
    ,      Print the $
     **    Multiply the byte values of a, > and a space
           62*97*32 = 192448
       .@  Print the number and terminate

Jo King

Posted 6 years ago

Reputation: 38 234

5

Befunge-98 (PyFunge), 8 bytes, $209728

$",**.q:

Try it online!

The character : has been computed using the following method:

>>> chr(int((1_000_000 * 8 ** -0.75) / (ord(' ') * ord('q'))))
':'

Using @ and f also works but gives only $208896.

Vincent

Posted 6 years ago

Reputation: 601

5

Excel VBA - 22 Bytes, $97336

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

How it works

? - Print in immediate
 "$" - $ character
 asc(".") = 46
 Asc("") = 3
  46 ^ 3 = 97336

OWSam

Posted 6 years ago

Reputation: 151

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) – Chronocidal – 6 years ago

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

– Taylor Scott – 6 years ago

5

Cubix, $155088 (12 bytes)

*Ouo'ე'$/@

Try it online!

An interesting problem, was hoping to get this down to 7 or 8 bytes, but it proved difficult. Pushes the ე and $ characters to the stack, outputs the $, multiples top of stack, outputs the number and halts. Still hoping to find a lower byte option

MickyT

Posted 6 years ago

Reputation: 11 735

4

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).

Dennis

Posted 6 years ago

Reputation: 196 637

4

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.

Sean

Posted 6 years ago

Reputation: 4 136

What about just 20000? Try it online!

– Jo King – 6 years ago

2

Actually though, I think this is just a snippet, so you should make it a function or a full program. 162754

– Jo King – 6 years ago

@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. – Sean – 6 years ago

But since it's hardly a big deal... – Sean – 6 years ago

1162754 – Jo King – 6 years ago

4

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.

nwellnhof

Posted 6 years ago

Reputation: 10 037

Where's the dollar sign? – Zaid – 6 years ago

1@Zaid The dollar sign comes XORing 0x35 (ASCII char 5 from the Perl version string in $]) with 0x11, resulting in 0x24 (ASCII char $). – nwellnhof – 6 years ago

Wait, this source does contain numbers — namely 0, 1, 6. – hidefromkgb – 6 years ago

@hidefromkgb Hex escapes like \x11 are ASCII control chars in the actual code. Have a look at the TIO link. – nwellnhof – 6 years ago

4

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).

Ismael Miguel

Posted 6 years ago

Reputation: 6 797

4

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.

BradC

Posted 6 years ago

Reputation: 6 099

4

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.

Veskah

Posted 6 years ago

Reputation: 3 580

1You can golf some bytes (and thus improve the salary) using + instead of [int] like follows -- "`$$(+[char]"C")"+(+[char]'~') – AdmBorkBork – 6 years ago

1Take 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 – mazzy – 6 years ago

1Enjoy the bonus: "$"+($x=+'i'[""])+$x, $105105, 20 bytes – mazzy – 6 years ago

1One 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". – mazzy – 6 years ago

1Newerending story... +'i'['']|%{"$ $_$_"} with Scrooge McDuck emoji string $ $_$_ – mazzy – 6 years ago

4

Swift, $131072 (13 bytes)

"$\(MAXPHYS)"

In Swift Playground it prints "$131072"

aix

Posted 6 years ago

Reputation: 41

1Welcome to PPCG! – Luis felipe De jesus Munoz – 6 years ago

4

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.

Arc676

Posted 6 years ago

Reputation: 301

1here'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. – Ross Presser – 6 years ago

1And you can save a byte by doing simply ≡⍬ instead of ⍬≡⍬ – Ross Presser – 6 years ago

3

Hexagony, 12 bytes, $122122

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

Try it online!

user202729

Posted 6 years ago

Reputation: 14 620

3

Brain-Flak, $55555

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

Try it online!

Brain-Flak with -r flag, $57777

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

Try it online!

Nitrodon

Posted 6 years ago

Reputation: 9 181

3

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!

AlexRacer

Posted 6 years ago

Reputation: 979

1var x:byte=ord('&');begin write('$',x*x*x)end. saves a byte, but does not increase salary. – Jonathan Allan – 6 years ago

3

><>, 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

Jo King

Posted 6 years ago

Reputation: 38 234

3

Bubblegum, $260847 (6 bytes)

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

Try it online!

Anders Kaseorg

Posted 6 years ago

Reputation: 29 242

3

><>, 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

Teal pelican

Posted 6 years ago

Reputation: 1 338

3

Haskell, $99999 (15 bytes)

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

Try it online!

Anders Kaseorg

Posted 6 years ago

Reputation: 29 242

3

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.

maxb

Posted 6 years ago

Reputation: 5 754

3

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

EdgyNerd

Posted 6 years ago

Reputation: 1 106

Ok, fixed all problems with it now – EdgyNerd – 6 years ago

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 – EdgyNerd – 6 years ago

1+1 for clever use of Unicode characters. – None – 6 years ago

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. – Lyxal – 6 years ago

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 – EdgyNerd – 6 years ago

2

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 :)

Felix Palmen

Posted 6 years ago

Reputation: 3 866

2

Japt, 7 bytes, $232,255

'$+#è#ÿ

Try it online!

Luis felipe De jesus Munoz

Posted 6 years ago

Reputation: 9 639

1Same 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. – Shaggy – 6 years ago

@Shaggy didnt notice, couldnt get 232256 though – Luis felipe De jesus Munoz – 6 years ago

Sorry, that was a typo; should've been 232255. – Shaggy – 6 years ago

@Shaggy The byte count is correct in Japt’s native ISO-8859-1 encoding.

– Anders Kaseorg – 6 years ago

2

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.

Neil

Posted 6 years ago

Reputation: 95 035

:( so close – ASCII-only – 6 years ago

2

LOWER, $40457

72 bytes

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

Try it online!

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

AlexRacer

Posted 6 years ago

Reputation: 979

2

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'*'Α');

Master_ex

Posted 6 years ago

Reputation: 526

It shouldn't change your solution much, but the required format is dollar sign first, then value – Nicola Sap – 6 years ago

2

><>, 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

Draco18s no longer trusts SE

Posted 6 years ago

Reputation: 3 053

3Challenge said no input... Nice language, still. – Stéphane Gourichon – 6 years ago

@StéphaneGourichon Oh shoot! :\ – Draco18s no longer trusts SE – 6 years ago

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.

– Draco18s no longer trusts SE – 6 years ago

2

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

u_ndefined

Posted 6 years ago

Reputation: 1 253

2

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!

Mego

Posted 6 years ago

Reputation: 32 998

2

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.

ItsJ0el

Posted 6 years ago

Reputation: 95

@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. – ItsJ0el – 6 years ago

16 dollars off the max – Jo King – 6 years ago

2

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)

dissemin8or

Posted 6 years ago

Reputation: 141

2

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

J. Sallé

Posted 6 years ago

Reputation: 3 233

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! – Kevin Cruijssen – 6 years ago

@KevinCruijssen just did that, thanks! – J. Sallé – 6 years ago

You don't need to cast it, "$",$*/"//;" works just as well and puts you at a higher cap – Thaufeki – 6 years ago

2

Python 2, $101106 $101937 (21 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(u"")

Outputs:

$ 101937

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.

Aaron F

Posted 6 years ago

Reputation: 141

1

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)

– Dennis – 6 years ago

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. – Aaron F – 6 years ago

2

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.

Silvio Mayolo

Posted 6 years ago

Reputation: 1 817

2

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...)

Hoki

Posted 6 years ago

Reputation: 271

2

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...

anatolyg

Posted 6 years ago

Reputation: 10 719

You don’t have to escape that. And why not use a 3-character literal?

– Anders Kaseorg – 6 years ago

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. – anatolyg – 6 years ago

Do the rules allow you to skip main? This code doesn't compile... – l33t – 6 years ago

2

dc, $177147 (9 bytes)

[$]nAvB^n

Try it online!

$\lfloor\sqrt{10}\rfloor^{11}$.

Anders Kaseorg

Posted 6 years ago

Reputation: 29 242

2

brainfuck, 30 bytes, $77'777

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

BF-Crunch did most of the work for me.

Try it online!

Dennis

Posted 6 years ago

Reputation: 196 637

2

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

wastl

Posted 6 years ago

Reputation: 3 089

2

Shakespeare Programming Language, $18000 (207 205 bytes)

,.Ajax,.Ford,.Act I:.Scene I:.[Enter Ajax and Ford]Ajax:You be the square oftwice the sum ofa cat a big cat.Speak thy.You cat.Open heart.You be the cube oftwice twice the sum ofyou a big big cat.Open heart

Try it online!

This language made this challenge simultaneously easy and hard. On one hand, there already are no numbers in the source code. On the other hand, the program size can get VERY long (the shortest header is 51 bytes, meaning I'm already out $947601.07!).

Salary printed: $18000

Maximum salary: $18457.99 (rounded)

JosiahRyanW

Posted 6 years ago

Reputation: 2 600

I believe your score is the number you printed, not the maximum salary. Interesting answer! – Conor O'Brien – 6 years ago

Thanks. I literally print $, 1, and then 8000. – JosiahRyanW – 6 years ago

1$20736 – Jo King – 6 years ago

How do you always do better than me? Clever use of the ASCII value of the dollar sign! – JosiahRyanW – 6 years ago

2

PowerShell, $1, 17 bytes

Owner's salary:

"$"+[bigint]::One

Try it online!

mazzy

Posted 6 years ago

Reputation: 4 832

2You could do "$"+[bigint]::One+[bigint]::One+[bigint]::One+[bigint]::One+[bigint]::One and get $11111, keeping you below the limit. – maxb – 6 years ago

**An entry is valid if** the value it outputs is not greater than ($1'000'000) · *b*<sup>-0.75</sup> Why would the owner break the rules? :) – mazzy – 6 years ago

Thanks for TIO link. I have the error This site can’t be reached with this site – mazzy – 6 years ago

O, Powershell syntax highlighting! Thanks! – mazzy – 6 years ago

maybe I'm missing something, but the length of what I posted above is 73 bytes, giving a maximum allowed salary of $40041. – maxb – 6 years ago

1Yeah, It's Owner's salary. :) It's reguired [bigint] to write his salary – mazzy – 6 years ago

2

Braingolf, 8 bytes, $209,764

#$@#å+*

Output:

$209764

209764 < 1e6 * 8-0.75

Try it online!

FatalError

Posted 6 years ago

Reputation: 119

nice to see somebody else using braingolf! – Skidsdev – 6 years ago

1#$!@**8/ gives $209952 in the same number of bytes by doing (36^2)^2 / 8 – Skidsdev – 6 years ago

1

SmileBASIC, 10 bytes, $131072

?"$";#R*#L

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

12Me21

Posted 6 years ago

Reputation: 6 110

1

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

." $"char  .

Try it online!

NieDzejkob

Posted 6 years ago

Reputation: 4 630

+1 I feel silly for only now realizing that you don't need a space after the closing " to a ." word – reffu – 6 years ago

1

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))

Jo King

Posted 6 years ago

Reputation: 38 234

1

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

Aaron F

Posted 6 years ago

Reputation: 141

1

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)

Chronocidal

Posted 6 years ago

Reputation: 571

You could just use ÿ to get a slightly higher salary. ?""ASC("e")&ASC("ÿ") 101255 – OWSam – 6 years ago

1

Common Lisp, $72447 (33 bytes)

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

The character is Unicode U+11AFF.

Try it online!

Renzo

Posted 6 years ago

Reputation: 2 260

1

Pyth, $161051 (11 bytes)

+\$^hT/ThhZ

Prepends a '$' sign to the result of 11^5.

Venerax

Posted 6 years ago

Reputation: 21

1

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

Moacir

Posted 6 years ago

Reputation: 179

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. – Teal pelican – 6 years ago

Indeed, but the rules state that I cannot use numbers :) – Moacir – 6 years ago

1I'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 – Teal pelican – 6 years ago

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.

– Anders Kaseorg – 6 years ago

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)? – Moacir – 6 years ago

As far as I can tell, the consensus is that using this kind of extra information is fine as long as it’s included in the byte count, so I’d just recommend editing to count the row number as 6 extra bytes. – Anders Kaseorg – 6 years ago

1

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.

anatolyg

Posted 6 years ago

Reputation: 10 719

1

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

maxb

Posted 6 years ago

Reputation: 5 754

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. – Skillmon – 6 years ago

@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. – maxb – 6 years ago

1

SQLite, 26 bytes, $86850

select'$'||unicode('')

Try it online!

Inspired by T-SQL @BradC answer

digEmAll

Posted 6 years ago

Reputation: 4 599

1

FreeBASIC, $124095 (16 bytes)

?"$" &&hc &&hfff

prints

$124095

? means print

&h is the hex prefix

& connects parts together

Tested using FreeBASIC online

CyberianRat

Posted 6 years ago

Reputation: 111

1

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

Lui

Posted 6 years ago

Reputation: 519

1

Common Lisp, 59 bytes $46974

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

Try it online!

JRowan

Posted 6 years ago

Reputation: 231

1

Runic Enchantments, 6 bytes, $255000

Thought I'd hit up a few challenges with the language I wrote a few days ago. TIO doesn't yet have an interpreter for it (coming soon I hope). Character set and execution is similar to ><>, but with an extended set of available commands, multiple IPs, and IP "energy" (some commands--such as o (sort)--require/consume mana and IPs with 0 mana are terminated).

'ÿY'$@

Try it online!

Explanation

>          Implicit entry (single line programs only; does not occupy a cell)
 'ÿ        push ÿ as a character
   Y       multiply by 1000 (implicit conversion to 255)
    '$     push $ as a character
      @    print entire stack and terminate the IP

An earlier attempt was e|$$$':* (push 15, reflect, push 15, multiply, duplicate, push $, print, print, print, (print: empty stack: IP terminated), resulting in $196196 however I realized that I could use @ instead of $$ which got me f|@$':* with a score of $225225, but further experimentation showed that I could get down to six characters starting from Pbp'$@ (push PI, push 11, power, push $, print and terminate), which was c5p'$@. But that ran into the issue of no digit characters allowed (ironically, both entries resulted in higher outputs).

2 IPs (because the language can): 148642 (max 155100)

>e'$@
FFm\>

Try it Online

Explanation

This will be a little hard to follow, but hopefully it makes sense. Instruction pointers wrap when they reach the edge of the program.

>
    >      Entry points (each IP begins with 10 mana)
----------------------
 e         Push 14
F          Fizzle
----------------------
  '        Enable single character read mode
 F         Fizzle
----------------------
   $       Push '$'
  m        Push current mana (8)
----------------------
    @      Print stack ($14) and terminate
   /       Reflect upwards
----------------------
   $       Pop and print (8)

----------------------

   /       Reflect right
----------------------
   $
mFF/       Push current mana (6), fizzle twice, reflect up
           At this point the IP is in a loop. It will terminate
           when it pushes a (2) and fizzles twice to end up with 0 mana

Draco18s no longer trusts SE

Posted 6 years ago

Reputation: 3 053

Note that non-competing doesn't apply to new languages anymore – Jo King – 6 years ago

@JoKing Oh? I didn't find that on meta. – Draco18s no longer trusts SE – 6 years ago

2Note that you can't use numbers in your source (the 5 is illegal). – Spitemaster – 6 years ago

@Spitemaster and updated. Both versions actually managed HIGHER outputs as a result. Heh. – Draco18s no longer trusts SE – 6 years ago

If I'm reading the challenge correctly, 7 bytes only allows for a maximum of $232368 – recursive – 6 years ago

@recursive Program is only 6 bytes, the header is typo'd. – Draco18s no longer trusts SE – 6 years ago

ÿ is a two byte character, so this is 7 bytes – Jo King – 6 years ago

1

JavaScript, 31 bytes, $74088

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

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

guest271314

Posted 6 years ago

Reputation: 1

1

C (clang), $70560 (34 bytes)

main(){printf("$%d",'*'*'*'*'(');}

Try it online!

Logern

Posted 6 years ago

Reputation: 845

1

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 ""

Thaufeki

Posted 6 years ago

Reputation: 421

1

Z80Golf, $123456 (12 bytes)

00000000: 0606 3e24 ffc6 0c3c ff10 fc76            ..>$...<...v

Try it online!

Assembly:

ld b, 6 ; loop 6 times
ld a, 24h ; '$' char
rst 38h
add 0Ch ; 30h='0' char
loop:
	inc a
	rst 38h ; putchar
	djnz loop
halt

Try it online!

Logern

Posted 6 years ago

Reputation: 845

1

Oracle SQL, 54 bytes ($50200)

select '$'||to_number(rawtohex('─↑'),'xxxx') from dual

Symbols must have codes 196 and 24 because 196 * 256 + 24 = 52000. Symbols may differ for different code pages, demonstrated result tested for code page 437.

SQL> select '$'||to_number(rawtohex('─↑'),'xxxx') from dual
  2  /

'$'||TO_NUMBER(RAWTOHEX('─↑'),'XXXX')
-----------------------------------------
$50200

SQL> exit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

C:\Windows\System32>chcp
Active code page: 437

Oracle SQL, 44 bytes ($57343)

select '$'||ascii(unistr('\DFFF')) from dual

Max allowed number in this case is 58534 but the max one in HEX without digits is DFFF.

SQL> select '$'||ascii(unistr('\DFFF')) from dual
  2  /

'$'||A
------
$57343

Dr Y Wit

Posted 6 years ago

Reputation: 511

Nice work. You should put the resulting salary in your header as well, so we can see that at a glance. – BradC – 6 years ago

1

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.

KrystosTheOverlord

Posted 6 years ago

Reputation: 681

1

Befunge-93 (FBBI), $209024 (8 bytes)

",**.@G$

Try it online!

negative seven

Posted 6 years ago

Reputation: 1 931

1

Note that this beats the previous Befunge-93 answer because this interpreter doesn't follow spec on pushing a space when wrapping

– Jo King – 6 years ago

1

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...

GammaFunction

Posted 6 years ago

Reputation: 2 838

I believe command-line arguments are included in the byte count. Good answer, though! – Purple P – 5 years ago

@PurpleP I like the reasoning of this meta post, but feel free to draw your own conclusions. :P

– GammaFunction – 5 years ago

0

PHP, 18 Bytes $98301

Using the defined constants of php core.

$<?=E_ALL*SIGQUIT;

It's simple E_ALL = 32767 and SIGOUIT = 3

Output

$98301

**No restriction on use of defined constants :D

Francisco Hahn

Posted 6 years ago

Reputation: 591

Gonna fix it (should not post from my phone) – Francisco Hahn – 6 years ago

Actually the ouytput is $98301 – Francisco Hahn – 6 years ago

0

Pip, $192,450 (9 bytes)

'$.A'

Try it online!

Boring "codepoint of Unicode character" answer. A more interesting (but slightly less lucrative) 9-byte approach is this:

'$.A'XPI

which gives $191,919 by string-repeating the codepoint of (19) $\pi$ times (rounded down).

DLosc

Posted 6 years ago

Reputation: 21 213

0

plain TeX (using pdftex), $91126 (24 bytes)

\$\number`[\number`~\bye

Output is printed into a PDF.

Explanation: \number` prints the decimal place in the ASCII table of the following character.

Skillmon

Posted 6 years ago

Reputation: 431

0

brainfuck, 44 bytes, $57777

Omg, first time trying this thing.... I don't even know how I did it xD

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

Try it online!

Luis felipe De jesus Munoz

Posted 6 years ago

Reputation: 9 639

0

PHP, $122122 (17 bytes)

$<?=$a=ord(z),$a;

first attempt, $80662, 25 bytes:

$<?=(M_PI**M_PI)**M_PI<<!A;

test script

Titus

Posted 6 years ago

Reputation: 13 814

0

Swift 4, $50653 (50 bytes)

let a=UnicodeScalar("%")!.value;print("$\(a*a*a)")

Try it online!

Arnab

Posted 6 years ago

Reputation: 101

1

Using your code you can golf this a bit (I have never done swift). Move the variable into the code itself and use a higher char for the unicode value and replace the aaa with a single call. https://tio.run/##Ky7PTCsx@f@/oCgzr0RDSSVGIzQvMzk/JTU4OTEnsUhD6f206UqainpliTmlqZpKmv//AwA

– Teal pelican – 6 years ago

0

BASH, $82154 (28 bytes)

printf \\b!T|xxd -p|tr $[] $

Try it online.

This one requires an ASCII-capable machine, as \b, !, T must have code table positions 0x08, 0x21, 0x54 respectively. $[] is an empty arithmetic context whose result is 0.

hidefromkgb

Posted 6 years ago

Reputation: 211

0

Python 3, $78011 & 23 bytes

print("$",ord(""))

This is really simple, I just used the largest ordinal value I could find.

Try it online!

Josh B.

Posted 6 years ago

Reputation: 105

0

Backhand, $189642 (9 bytes)

""o@$*O}

Try it online!

This was a bit of a weird one. The unprintable in the middle has a char value of 24.

Explanation:

Note that the pointer typically moves three steps at a time

"            Starts a string literal
   @        Pushes some characters to the stack
             Bounces off the edge and go left
 "  $  O     Push some more chars and end the string literal
             Bounce off the edge and go right
  o          Output the $
     *       Multiply the O (79) by the unprintable (24) = 1896
        }    Step to the right, which bounces off the edge, so steps left instead
       O     Output the 1896
 "  $        Start another string literal and reflect
  o  *  }    Push chars and reflect
  o  *       Push more chars and reflect
 "           End string literal
    $  O     Swap the o and * and outputs the * as a number (42)
   @        Unprintable (ignored) and then terminates

Most of this was from accidentally using } (step right) instead of { (step left) as the last char, which led me to find out that this used the O (output number) twice, so I could avoid having to do too much more fiddling.

Jo King

Posted 6 years ago

Reputation: 38 234

0

Lua, $74088 (32 bytes)

s='*'x=s:byte()print('$'..x*x*x)

Try it online!

How:

s:byte()returns an integer equivalent to string s ASCII value, '*' value is 42, 42^3=74088. I guess this is the optimal solution for the size of the code I managed to think of, feel free to prove me wrong.

Marcio Medeiros

Posted 6 years ago

Reputation: 51

0

Aheui (esotope), 30 bytes, $73636

밦밦따빠맣빠뱘휉망어

Try it online!


Explanation:

밦: push 6, move cursor right by 1(→).
밦: push 6, →
따: mul(push 36), →
빠: dup(push 36), →
맣: print as character(36 > '$'), →
빠: dup(push 36), →
뱘: push 7, move cursor right by 2(→→).
휉: end.
망: print as integer, →
어: move cursor left by 1(←).

Note: Print instruction moves cursor in reverse direction if current storage is empty.

cobaltp

Posted 6 years ago

Reputation: 401

0

C (gcc) - 26 bytes - $53159

main(){printf("$%d",'ϧ');}

Try it online!

bznein

Posted 6 years ago

Reputation: 121

Isn't the max for 26 bytes $86850.03? Couln't you use a higher unicode value? – Jo King – 6 years ago

This is actually 27 bytes. – Dennis – 6 years ago

0

C, $82154 (28 bytes)

main(){printf("$%x",'!T');}

Try it online!

l33t

Posted 6 years ago

Reputation: 101

0

Canvas, $279936 (5 bytes)

$67^+

Try it here!

Note that the 6 & 7 there are full-width characters, not ASCII numbers.

dzaima

Posted 6 years ago

Reputation: 19 048

0

cQuents, $177800 (10 bytes)

@$#t:tto۲

Try it online!

Explanation

@$          prepend $
  #t        output tenth term in sequence
    :       each term in the sequence equals
     tt       10 * 10 * 
       o۲               python ord("۲"), which is 1778

Stephen

Posted 6 years ago

Reputation: 12 293

0

Perl 6, 18 bytes ($114431)

say '$'~ord ''

bb94

Posted 6 years ago

Reputation: 1 831

0

Ink, $56789, 43 bytes

$<>
-(o)~temp q=o+o+o+o
-(t){t+q}{t<=q:->t}

Try it online!

Explained

$<>               // Print a dollar sign and do not print a trailing newline.
-(o)              // Create a gather, and give it the label o. This creates a variable o, which keeps track of how many times this gather has been reached
                  // It is currently set to 1, and it will stay that way.
~temp q=o+o+o+o   // Create a variable q, containing the number 4.
-(t)              // Another label, another variable.
{t+q}             // print t + q, that is to say t + 4
{t<=q:->t}        // If t is not greater than q, jump to the gather labelled t
                  // (this automatically increments the t variable)

Alternative solution: $66666, 31 bytes, but

I did find a better solution, but I don't like it, because it abuses a bug in the interpreter:

-(n){|}$<>
-(t){t<n+n:{n+n}->t}

Try it online!

The {|} is a sequence - it outputs one string (the empty string, in this case) the first time the line is reached, and another string (which in this case is also the empty string) every subsequent time the line is reached.
This might not seem useful here, since we never return to that line. But in the current version of Inklecate, when a sequence occurs immediately after a labelled gather, the gather's readcount increments three times rather than the usual one.
This makes it easy to produce a 3, which we then use to print the number 6 five times.

Sara J

Posted 6 years ago

Reputation: 2 576

0

33, $139,968 (12 bytes)

"$"jcaaaxxpo

Explanation

"$"       p  | Prints '$'
   jca       | Loads 36 (ASCII value of '$') into the accumulator and counter
      aaxx   | Trebles it (108), then multiplies the result by 1,296 (139,968)
           o | Prints it

TheOnlyMrCat

Posted 6 years ago

Reputation: 1 079

0

Cascade, $177827, 10 bytes

^$
 #"

Try it online!

I'm lucky here in that counts as a letter variable, which allows me to fetch its ordinal value, with the cost that it is a multi-byte character.

Jo King

Posted 6 years ago

Reputation: 38 234

0

Go, $84426

func f(){print("$",'')}

The character in the single quotes is the Unicode character with code point U+149CA, encoded as 4 bytes in UTF-8. The Unicode standard does not currently assign it a value, but it is nevertheless valid to place it in Go source code, earning me only 18 cents below the maximum for 27 bytes. If you prefer, the character U+14646 Anatolian Hieroglyph A530 is the nearest that is assigned, though it only gets me $83526.

Purple P

Posted 6 years ago

Reputation: 919

0

Wren, 34 bytes, $71021

Wren's verbosity ruined the game.

System.printAll(["$"]+"
".bytes)

Try it online!

user85052

Posted 6 years ago

Reputation:

-1

Excel, $260847, (6 Bytes)

(Max of 260847.43 at 6 bytes)

=Row()

In cell A260847 (or any other cell in the row), simply have =Row(). Row returns the row of the reference in question, and when nothing is given, simply returns the row of the cell that the formula is in.

We can then use Excel's Accounting formatting to insert the $ for us (or any other type of custom formatting).

This makes us extremely efficient and effective!

Selkie

Posted 6 years ago

Reputation: 159

4Welcome to PPCG! While this is a clever idea, it is unfortunately not valid as you need to output the $ as well! – Giuseppe – 6 years ago

1Giuseppe: Is having the $ displayed not valid? – Selkie – 6 years ago

4Yep, the requirements are for a program/function that outputs a text containing a dollar sign ($, U+0024) and a decimal representation of a number (integer or real) -- I missed this my first time as well! – Giuseppe – 6 years ago

2One could also argue that the six bytes in 260847 (the cell's position) have to be included, since it is information available to the program. – Jonathan Frech – 6 years ago

@JonathanFrech what’s the meta consensus on that? I could not fin an answe here

– JayCe – 6 years ago

2

@JayCe Loopholes that may be applicable include this and this.

– Jonathan Frech – 6 years ago

Clever, but I have similar questions. My major problem with using cell formatting to produce part of the required output is: how do you account for that in the score? Surely it should impact the score in some way, if only to add 1 (1 click on the currency format button). For that matter, should there be some adjustment to the score for requiring the user to scroll down to row 260,847? Do we could how many times you have to press page down? Or the keystrokes to jump to a certain cell? – BradC – 6 years ago

@BradC I would intuitively argue that the cell's entropy which is being used is the information stored in its position. This information is in this case represented decimally using six bytes. I, however, also could not find definitive consensus on this specific byte count issue. – Jonathan Frech – 6 years ago