text:
Make a sprite-sheet from all the Stack Exchange sites' favicons
Your goal in this code golf is to compile all the Stack Exchange sites' favicons.

Getting the Domains
The domains you will be using will be:

*.stackexchange.com
stackexchange.com
stackoverflow.com
superuser.com
serverfault.com
askubuntu.com
mathoverflow.net
stackapps.com
stackauth.com

Everything but stackexchange.com and stackauth.com, as of now, can be gathered from /sites.
All the meta counterparts will also be included. (just prepend meta. to the beginning of any of the domains to get the meta site)
The list above shows the order of the sites. Sites without their own domain (*.stackexchange.com, i.e. codegolf.stackexchange.com) are first in the stylesheet, and are sorted alphabetically. After you've sorted the subdomain sites, the rest of the domains are in the order listed above.
Then, you can append /favicon.ico to each one of the domains you dynamically compiled and get the 32 by 32 pixel image that results from it.
Here's another list for domains that redirect to *.stackexchange.com sites:

askdifferent.com → apple.stackexchange.com
arqade.com → gaming.stackexchange.com
seasonedadvice.com → cooking.stackexchange.com

Output the Images
As soon as you have all of the favicons from the sites and their meta counterparts, your code combines them. Optionally, convert them into .PNG files (you gathered .ICOs, and trying to get favicon.png doesn't work) After that, you can start combining the images into one rectangle.
There will be 10 columns, each 32 pixels in width, making a total of 320 pixels. The number of rows will match those needed to fit all the favicons, and they are 32 pixels in height.
Your code should output an image with all of the favicons you gathered as a transparent .PNG file, which is already , like seen below:

Scoring
This is code-golf and so the least bytes wins!
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, N bytes

where N is the size of your submission. If you improve your score, you can keep old scores in the headline, by striking them through. For instance:
# Ruby, <s>104</s> <s>101</s> 96 bytes

var QUESTION_ID=86753;function answersUrl(e){return"http://api.stackexchange.com/2.2/questions/"+QUESTION_ID+"/answers?page="+e+"&pagesize=100&order=desc&sort=creation&site=codegolf&filter="+ANSWER_FILTER}function getAnswers(){jQuery.ajax({url:answersUrl(page++),method:"get",dataType:"jsonp",crossDomain:!0,success:function(e){answers.push.apply(answers,e.items),e.has_more?getAnswers():process()}})}function shouldHaveHeading(e){var a=!1,r=e.body_markdown.split("\n");try{a|=/^#/.test(e.body_markdown),a|=["-","="].indexOf(r[1][0])>-1,a&=LANGUAGE_REG.test(e.body_markdown)}catch(n){}return a}function shouldHaveScore(e){var a=!1;try{a|=SIZE_REG.test(e.body_markdown.split("\n")[0])}catch(r){}return a}function getAuthorName(e){return e.owner.display_name}function process(){answers=answers.filter(shouldHaveScore).filter(shouldHaveHeading),answers.sort(function(e,a){var r=+(e.body_markdown.split("\n")[0].match(SIZE_REG)||[1/0])[0],n=+(a.body_markdown.split("\n")[0].match(SIZE_REG)||[1/0])[0];return r-n});var e={},a=1,r=null,n=1;answers.forEach(function(s){var t=s.body_markdown.split("\n")[0],o=jQuery("#answer-template").html(),l=(t.match(NUMBER_REG)[0],(t.match(SIZE_REG)||[0])[0]),c=t.match(LANGUAGE_REG)[1],i=getAuthorName(s);l!=r&&(n=a),r=l,++a,o=o.replace("{{PLACE}}",n+".").replace("{{NAME}}",i).replace("{{LANGUAGE}}",c).replace("{{SIZE}}",l).replace("{{LINK}}",s.share_link),o=jQuery(o),jQuery("#answers").append(o),e[c]=e[c]||{lang:c,user:i,size:l,link:s.share_link}});var s=[];for(var t in e)e.hasOwnProperty(t)&&s.push(e[t]);s.sort(function(e,a){return e.lang>a.lang?1:e.lang<a.lang?-1:0});for(var o=0;o<s.length;++o){var l=jQuery("#language-template").html(),t=s[o];l=l.replace("{{LANGUAGE}}",t.lang).replace("{{NAME}}",t.user).replace("{{SIZE}}",t.size).replace("{{LINK}}",t.link),l=jQuery(l),jQuery("#languages").append(l)}}var ANSWER_FILTER="!t)IWYnsLAZle2tQ3KqrVveCRJfxcRLe",answers=[],page=1;getAnswers();var SIZE_REG=/\d+(?=[^\d&]*(?:<(?:s>[^&]*<\/s>|[^&]+>)[^\d&]*)*$)/,NUMBER_REG=/\d+/,LANGUAGE_REG=/^#*\s*([^,]+)/;
body{text-align:left!important}#answer-list,#language-list{padding:10px;width:290px;float:left}table thead{font-weight:700}table td{padding:5px}
<link rel="stylesheet" type="text/css" href="//cdn.sstatic.net/codegolf/all.css?v=83c949450c8b">

Leaderboard

	Author	Language	Size

Winners by Language

Language	User	Score

{{PLACE}}	{{NAME}}	{{LANGUAGE}}	{{SIZE}}	Link

{{LANGUAGE}}	{{NAME}}	{{SIZE}}	Link

You might want to consider providing a list of URLs to use and what order they should be in as it is a bit ambiguous at the moment. Also, what does "unlimited rows/height" mean? Do you intend every submission to output the same image or can users choose the dimensions of the rectangle?

@GamrCorps It means if more sites are added to the current lineup and they end up requiring a new line, then it can be added.

Ok. Two more questions though: are URL shorteners allowed and do you require submissions to be full programs, functions, or either? I think this question could have benefited time in the sandbox.

@GamrCorps Also, You can find a list of the Stack Exchange subdomains on Wolfram Alpha.

@GamrCorps URL shorteners are not allowed, and they have to be either

The list of Stack Exchange sites is not fixed; subdomains may be added or removed at all times. The challenge spec should include the list that is required for this task.

@Dennis It has to be dynamically found.

OK, so what about SE sites that aren't a subdomain of SE.com or SO.com? Should they be excluded?

@Dennis Can you give me examples?

superuser.com, serverfault.com, askubuntu.com, askdifferent.com, mathoverflow.net, stackapps.com, seasonedadvice.com, stackauth.com

What about parse the sites from http://stackexchange.com/sites ?

@GiacomoGarabello That is an option.

@Dennis, adding those into the main post.

Sites without their own domain The order of the images in the sprite-sheet will be that, except the separate sites not including Stack Overflow will be in alphabetical order. This entire part needs some major clarification. I mean Sites without their own domain... what? The order of the images in the sprite-sheet will be that what is "that"? And what are the "separate sites" mentioned here?

Not to say that this is a bad question. This can still be a pretty good question in my opinion. It just needs quite a bit of clarification.

@R.Kap, I've explained it a bit more. Somehow I never finished writing that sentence in my edit.

@Dennis, Seasoned Advice is actually at cooking.stackexchange.com and seasonedadvice.com is just a redirect, much like arqade.com redirects to gaming.stackexchange.com.

I feel like the sorting order needs to be less arbitrary. Instead of how you specified, can it just be *.stackexchange.com alphabetically by subdomain, then the remaining sites alphabetically by domain? Also, where are the meta sites factored in?

Actually, www.stackexchange.com/favicon.ico returns a 16 x 16 image.

Also, www.seasonedadvice.com/favicon.ico returns a 404 not found error.

@R.Kap you're right about stackexchange, but you forgot that seasonedadvice redirects: http://cdn.sstatic.net/Sites/cooking/img/favicon.ico. It's in my sprite-sheet.

@PatrickRoberts Yeah, but then again, OP did say to just append /favicon.ico to the end of each domain to get the favicon, but when I do that to www.seasonedadvice.com, I get the 404 error.

@R.Kap see this comment. He knows.

@PatrickRoberts Well then, in that case, why is www.seasonedadvice.com in the list? And if that has to be there, why isn't www.arqade.com also in the list?

Let us continue this discussion in chat.

www.stackauth.com also returns a 16 x 16 favicon.

@R.Kap, I've posted a question on Meta Stack Exchange.

JavaScript (ES6), 691 687 680 663 646 657 bytes

fetch(new Request('//crossorigin.me/http://stackexchange.com/sites')).then(r=>r.text(t=(d=document).body.appendChild(c=d.createElement('canvas')).getContext('2d')).then(a=>(d=new DOMParser(c.width=320).parseFromString(a,'text/html'),s=[...d.querySelectorAll('.grid-view-container>a')].map(e=>!~(h=e.href[p='slice'](7))[o='indexOf']('met')?h:h[p](5)),c.height=-~(s.length/5)*32,s.sort((a,b)=>(e=a[o](k='.s'),g=b[o](k),~e&&~g?a[l='localeCompare'](b):!~e&&!~g?a[p](e)[l](b[p](g)):g-e)).concat(s.filter(u=>!~u[o]('ka')).map(u=>'meta.'+u))).map((u,i,x,y)=>(u=`http://${u}favicon.ico`,x=i%10,y=(i-x)/10,i=new Image,i.src=u,i.onload=_=>t.drawImage(i,x*32,y*32)))))

Oof. Hopefully I can trim down the byte count.
Basically:

CORS request to /sites, parse DOM and scrape the site list from there using a query selector.
Sort first by *.stackexchange.com sites alphabetically, then by independent domain sites alphabetically.
Append the meta sites, filtering out meta.stackexchange.com and stackapps.com since they're both listed on /sites and are without their own meta site.
Asynchronously load each favicon.ico without CORS since we don't care about tainting the canvas.
Use each site's index i from the sorted array to place the loaded image in the correct position on the sprite-sheet.

You can right-click on the image and select "Save Image as", so I don't think I need to write more just to explicitly prompt the image for download, since it's already enough work just displaying it.
Revisions

Inlining global declarations saved 2 bytes. Submission is now one loooong line.
Removing () from new Image() saved another 2 bytes.
Changing Math.ceil(...) to -~(...) saved 7 bytes. Doesn't apply now, but in the event that the amount of sites is a multiple of 10, it's still okay because "There are 10 columns, which is 320 pixels in width, and unlimited rows/height" regardless of the amount of sites.
Saved 17 bytes by moving a global declaration and refactoring an unneeded ternary operator in a .map() function.
Saved another 17 bytes by storing long repeated method names to variables.
Cost 11 bytes to factor in stackexchange.com and its meta... gross.

Nothing seems to shows up when I run your code snippet and save the image...

@R.Kap does the sprite-sheet populate with all the favicons when viewing the program in progress? I'm running on Chrome 52 and it works perfectly. Make sure your browser supports the Request API and ES6. Check for errors in your console when running the program. If there are any, it would be helpful for me if you could share those.

Well, I am running the snippet in Firefox and don't really know if it supports the Request API. However, I know it does support ES6 since a lot of other ES6 snippets on PPCG do work. There are no errors in the console, so t's most likely that Firefox may not support the Request API.

http://codegolf.stackexchange.com/a/86853/42091 Since you're in Firefox and there are no errors, my guess is that it's blocking "non-secure requests from HTTPS to HTTP". Just click that link and make sure your URL is HTTP instead of HTTPS when running the script.

@R.Kap the first half is non-meta, second half is meta.

Yeah, I finally figured it out. Really good job! It looks awesome in Chrome. +1

Where is the www.stackexchange.com favicon? I don't see that in the output.

@R.Kap thanks for pointing that out... I think it's dumb that /sites includes its meta site, but not itself... I'll factor that in.

Also, do you have the www.stackauth.com favicon in there?

@R.Kap no, and that's okay. stackauth.com is not in /sites and according to the author of this challenge, parsing /sites for the list of favicons is acceptable.

@PatrickRoberts You can poll /sites, but you still need to include www.stackexchange.com and stackauth.com.

@Peanut I did include stackexchange but I don't understand why stackauth needs to be included when it's not listed in sites. You're changing your challenge's specification by making that a requirement.

@Peanut I don't appreciate you editing my answer without my permission. I'm reverting it. Don't do that again.

You can shorten this by replacing http://stackexchange.com/sites with http://s.tk/sites.

@R.Kap URL shorteners are not allowed

@PatrickRoberts Oh dang. I did not see that comment.

Looks like crossorigin.me is broken now.

@haykam Still a valid answer because it worked at the time of the question. I'll update the demo or remove it later depending on if I find an alternative.

Python 3.5, 591 549 541 557 570 bytes:
(+16 bytes (541 -> 557) to add the ability for the final image to dynamically expand in height based on the number of favicons gathered.)
(+13 bytes (557 -> 570) since URL shorteners are apparently not allowed.)
from urllib.request import*;from PIL import Image as I;from io import*;import re
H='http://';U=urlopen;u=y=0;V=sorted(re.findall('
'%H,U(H+'stackexchange.com/sites?view=list').read().decode()[7167:]))+['%s.com'%i for i in'stackexchange stackoverflow superuser serverfault askubuntu mathoverflow stackapps stackauth'.split()];i=I.new("RGBA",(320,-~(len(V)*2//10)*32))
for l in V+['meta.'+i for i in V]:
 try:
  i.paste(I.open(BytesIO(U(H+l+'/favicon.ico').read())),(u,y));u+=32
  if u>319:u=0;y+=32
 except:0
i.save('O.png')

Quite long, but hey, I beat Javascript! :D This imports the modules for the following uses:

urllib to fetch website and image data.
io module for the BytesIO function to decode the fetched image data for PIL.
re for the use of regular expressions to parse the website data.
PIL to create the final image from the fetched image data.

Creates and saves a 320 x 1024 PNG image named O.png in the current working directory, with all the favicons in the order specified. I will try to golf this down more over time as much as I can, but for now, I could not be happier. :)
Final Output Image:

+1 because it doesn't have duplicated Stack Overflow favicons, unlike the JavaScript version

Got an error: SyntaxError: Unexpected keyword 'case'. Expected a closing '}' at the end of a block statement.

@Peanut It works perfectly fine for me with Python 3.5 on Mac.

JavaScript, 563 bytes

a=[]
fetch`//api.stackexchange.com/sites?pagesize=999`.then(r=>r.json().then(j=>{p=j.items.forEach(i=>a.push(i.site_url+"/favicon.ico"))
s=a.sort()
g=s.filter(e=>/(?<!meta)\.stackexchange/.exec(e)).concat(["//stackexchange.com/favicon.ico"]).concat(s.filter(e=>!/meta|stackexchange/.exec(e))).concat(s.filter(e=>/meta/.exec(e)))
document.body.append(c=document.createElement`canvas`)
c.width=320
c.height=(g.length/10+0.9|0)*32
c=c.getContext`2d`
for(u in g){
var i=new Image()
i.src=g[u]
i.u=u
i.onload=(p)=>c.drawImage(b=p.target,b.u*32%320,((b.u/10)|0)*32)}}))

Generated image (as of writing this)

Explanation (key points)

fetch`//api.stackexchange.com/sites?pagesize=999`
▸ Fetch the list of all SE sites [API docs]
▸ -2 bytes: Uses ES6's tagged template
▸ -3~4 bytes: It also uses a trick // that takes advantage of Stack Snippets (otherwise, you'd have to replace // with http: or even https: because of CORS weirdness)
▸ Note: It only list the first 999 sites. While as of writing this, theres "only" 355 sites, this could reach 1000. then you'll need to add one byte: ...?pagesize="+2e9, which can go up to 2000000000! (more than that makes an invalid parameters error)

s=a.sort()
▸ Sort the list of URLs in alphabetical order (meta and normal aren't separated yet)

s.filter(e=>/(?<!meta)\.stackexchange/.exec(e))
▸ Filter all of the urls that doesn't contain meta but contains .stackexchange
.concat(["//stackexchange.com/favicon.ico"])
▸ Add stackexchange.com's favicon URL (Somehow stackexchange.com isn't on the list)
.concat(s.filter(e=>!/meta|stackexchange/.exec(e))
▸ Add all of the elements that doesn't contains meta or stackexchange
.concat(s.filter(e=>/meta/.exec(e))
▸ Add all of the elements that contains meta

c.height=(g.length/10+0.9|0)*32
▸ Set the height of the canvas to the number of urls(g.length) / 10(number of rows) approximately ceiled with +0.9|0

i.u=u
▸ Bind the URL id to the element so it can be drawn asynchronously after the onload()

c.drawImage(b=p.target,b.u*32%320,((b.u/10)|0)*32)}}))
▸ b.u*32%320 URL id(g.u) * 32(icon size) % 320(icon size*10)
▸ ((b.u/10)|0)*32 ((URL id(g.u) / 10(number of rows)) |0(floor)) * 32(icon size)


text:
Big or Little Endian
Write a program or function that outputs an L if run on a little endian architecture or a B if run on a big endian architecture. Lower case output l or b is also acceptable.
There is no input.
Scoring is code golf, so the code with the fewest bytes wins.
Edit: As per the comments below, I am clarifying that the entry must be able to run on either architecture.
I believe that there is only one answer that this affects, and that answer has clearly indicated that this is the case.

Does the little endian apply only to the memory, or every byte in the program source code as well?

The memory of the box. I'm not sure what you mean

I think this is an interesting challenge (and it's way out of the norm) but it's going to be extremely hard to test it. Especially since most of the code will end up being extremely platform specific.

Yeah I think it'll be interesting because hopefully it's something that esolangs and golfing languages have a harder time with than 'normal' languages. I have a feeling that they won't be that hard to verify. Worst case they should be verifiable by hand

I'm guessing that if the language has the programmer define an endianness independently for every variable (and no endianness is imposed by the computer/interpreter/compiler/hardware), then it cannot compete here?

Hmm, I suppose it's impossible to write a program like this in assembly then, since it'll be architecture specific at that point anyway.

I guess an answer based on a specific machine code is forbidden? Otherwise B0 4C C3, which is mov al, 'L' / ret or unsigned char f(){ return 'L'; }, would be a valid x86 answer.

I think it should be clarified that the code must run on both little-endian and big-endian architectures, not just one.

If someone wants to test with a big endian architecture, here are some ways: How to test your code on a machine with big-endian architecture?, Imitate/emulate a big-endian behavior in C?. Another way may be running your app in your ARM phone in big endian mode

Speaking of ARM, does anyone know enough about ARM (or PPC) assembly to write an endianness test in it?

Bravo! for a code golf challenge in which general-purpose programming languages can be competitive.

@Random832: done with PPC, I hope I haven't messed up too much (I knew next to nothing about PPC until 2 hours ago =) ); I'll see if I manage to do ARM.

Python, 33 bytes
import sys
exit(sys.byteorder[0])

sys.byteorder is either 'little' or 'big' (and for those of you who will read this sentence without looking at the code, [0] means take the first character).

The challenge says the output must be L and B (or the lowercase variant), not the entire word.

That's why it says sys.byteorder[0], i.e. the first char of byteorder.

C, 26 bytes
a=66<<24|76;f(){puts(&a);}

Assumes 32-bit int and ASCII characters.  Tested on amd64 (little-endian) and mips (big-endian).
GCC, 23 bytes
00000000: 613d 2742 0000 4c27 3b66 2829 7b70 7574  a='B..L';f(){put
00000010: 7328 2661 293b 7d                        s(&a);}

Suggested by feersum.  The value of multi-character constants is implementation-dependent, but this seems to work in GCC.  Tested on the same architectures.

Shorter is a='B\0\0L'; The \0s can be replaced with null bytes.

@feersum The endianness of multi-character constants seems to be implementation dependent. I wouldn't normally worry about that much in code golf, but this challenge is all about distinguishing between implementations.

Does this code currently work in something other than GCC?

@feersum I believe the 66<<24|76 solution should work on every standards-compliant C compiler (with 32-bit int and ASCII characters), but I don’t know how to easily access a big-endian C compiler other than GCC or clang.

Is there a standard for K&R style C? I didn't think something with missing types and implicit function definitions could be called standard-compliant.

@feersum C89 allows both.

Using xlc (VisualAge C++ Professional / C for AIX Compiler, Version 6) on an RS6000 running AIX 5.2 the 26 byte program successfully prints "B"

@FryAmTheEggman That wasn't the revision that didn't work. After downloading a virtual machine, I edited my answer and undeleted it, just after feersum had added his comment. I realized not only that it was too late, but that my fix was too similar to this answer, so I re-deleted it.

@Dennis Ah, whoops, thanks!

MATLAB / Octave, 24 bytes
[~,~,e]=computer;disp(e)

The computer function gives information about, well, the computer it's running on. The third output is endianness: L or B for little- or big-endian respectively.
Try it on Ideone.

what. This is somethign for stackoverflow, I didnt know this!

JavaScript ES6, 50 bytes
_=>"BL"[new Int8Array(Int16Array.of(1).buffer)[0]]

I don’t know who decided it was a good idea for TypedArray objects to expose the native endianness of the interpreter, but here we are.

WebGL people thought it was a good idea, to avoid having to convert endianness when passing to the GPU. Pretty much everyone else thought it stupid… :(

C, 36 35 bytes
1 byte thanks to @algmyr and @owacoder.
main(a){printf(*(char*)&a?"L":"B");}
main(a){putchar(66+10**(char*)&a);}
main(a){putchar("BL"[*(char*)&a]);}

Version 1: Ideone it!
Version 2: Ideone it!
Version 3: Ideone it!

Credits here.
Untested since I don't have a big-endian machine.

Does the C spec allow a one-argument main function?

@codesinchaos yes it does. It will be the number of command line arguments given. Usually here it is used to have a variable initiated to 1 because no input is given (and the program name always counts as the first argument)

@Liam: If anything other than 0 or 2 is allowed is implementation defined in C11.

I like how this could be broken by adding enough input arguments to either have a multiple of 255 or populate the top octet.

Also, if we really want things to break if there is input, we can save a byte with main(a){putchar(66+10**(char*)&a);}

Or main(a){putchar("BL"[*(char*)&a]);}.

@algmyr But the question clearly states: There is no input. So no command line arguments either

@CodesInChaos it's allowed and is used in many code ofuscation contests

@WorldSEnder I know, I just like volatile solutions.

I don't know a big-endian online compiler but you can use compiler explorer with a big-endian compiler and see the optimized asm output if it prints directly L or B

How to test your code on a machine with big-endian architecture?, Imitate/emulate a big-endian behavior in C?

If you mess with the call convention it goes down to 31: main(char a){putchar("BL"[a]);}.

@LưuVĩnhPhúc, one-argument main() is not forbidden by the standard, but neither is it allowed.  Implementations are explicitly permitted to support such signatures, but strictly-conforming programs cannot rely on them.  In other words, the program given is not written in standard C.  It may, however, be written in the idiosyncratic extended dialect of one or more C implementations.

@AndreaBiondo That worked well...

Mathematica, 22
{B,L}[[$ByteOrdering]]

This probably breaks some rule about not using a built-in function but I'm not really interested in rube goldberging an alternative.

Built-ins are fine (most answers are using them too)

And once again, Mathematica has a built-in!

I think this is a snippet, not a program or function, and you should add & to make it a function. (But there may be disagreement over what constitutes a “program”.)

@Anders I am not really familiar with the current standards for PCG (if I ever was) but IMHO one advantage of an interpreted language is that a snippet is a program.  This can be run in a stand-alone manner as much as any other program in Mathematica.

@Mr.Wizard Note that a "program" in Mathematica refers to a standalone script (which requires explicit printing), whereas this answer uses the REPL.

@Legion I feel that this is a matter of opinion unless you can support your position with an authoritative reference.

C, 27
One byte longer, but here it is anyway:
f(){putchar(htons(19522));}

It worked fine, can you please explain it to me.

@ABcDexter the binary expansion of 19522 is 1001100 01000010 (space to separate bytes). Now if you take each byte, convert back to base 10 and check the ASCII table, you will see that this byte sequence is equivalent to LB. htons will do its thing, and putchar will only print the LSB. In big-endian systems, that will be B, in little-endian, htons will have flipped the bytes, so the LSB is L.

Replace 19522 with 'LB' for compiler warnings and -1 byte.

PowerPC machine code - 20 bytes
PowerPC is bi-endian (the endianness can be set up at startup), so this code should conform to the challenge request of being able to run both on BE and LE machines. This is a function that returns1 'L' or 'B' depending on the endianness currently set.
As a function, AFAICT it conforms the SVR4 PowerPC ABI (used by Linux on ppc32), the PowerOpen ABI (used e.g. by AIX) and the OS X ABI. In particular, it relies just on the fact that GPR 0 is a volatile scratch register, and GPR 3 is used to return "small" values.
00000000 <get_endian>:
   0:   7c 00 00 a6     mfmsr   r0
   4:   54 03 0f fe     rlwinm  r3,r0,1,31,31
   8:   1c 63 00 0a     mulli   r3,r3,10
   c:   38 63 00 42     addi    r3,r3,66
  10:   4e 80 00 20     blr

Now, it goes like this:

the MSR is read into GP register 0; the MSR contains at bit 31 the endianness settings (0 = big endian; 1 = little endian);
rlwinm extracts just that bit: it takes the value in GPR0, rotates left by 1 place (so that now is in position 0) and masks it with 1 (the mask generated by those 31,312); the result is put into GP register 3;
multiply the result by 10 and sum 66 ('B') (10 is the difference between 'L' and 'B')
finally, return to the caller

Notes

yep, the question does ask to print, but it's not clear how I should print stuff in assembly expected to run unmodified on different operating systems. =)
for those interested, see the rlwinm documentation; knowing next to nothing about PowerPC, I found this kind of instructions extremely interesting.
2018 update: Raymond Chen is publishing a series about the PowerPC architecture, you can find here his great post about rlwinm & friends.

Java 8, 96, 64 52 bytes
()->(""+java.nio.ByteOrder.nativeOrder()).charAt(0);

A golf based on this SO answer. All credit goes to @LeakyNun and @AlanTuning. Java keeps the loosing streak.
96 bytes:
 char e(){return java.nio.ByteOrder.nativeOrder().equals(java.nio.ByteOrder.BIG_ENDIAN)?'b':'l';}

64 bytes:
char e(){return(""+java.nio.ByteOrder.nativeOrder()).charAt(0);}

Untested b/c I don't have access to a big-endian machine.

char e(){return(""+java.nio.ByteOrder.nativeOrder()).charAt(0);}

char e(){return(""+java.nio.Bits.byteOrder()).charAt(0);}

@LeakyNun I don't see Bits in the Java API, and when I run it it gives me "Bits is not public in java.nio"

Oh, alright then.

52 bytes if you use a lambda! ()->(""+java.nio.ByteOrder.nativeOrder()).charAt(0);

Perl, 38 36 bytes
say+(pack"L",1 eq pack"V",1)?"L":"B"

Works by packing a number in the system's default byte order and comparing it to a number packed in little-endian byte order.

(G)Forth, 24 bytes
here $4200004C , c@ emit

Assumes that cells are 32 bits (and that your Forth interpreter supports Gforth's base prefixes).  It simply stores the number 0x4200004C in memory and then displays the byte at the low end.

PHP 5.6, 41 31 bytes (thx to isertusernamehere)
<?=unpack(S,"\x01\x00")[1]-1?B:L;
PHP 7, 41 bytes
echo unpack('S',"\x01\x00")[1]-1?'B':'L';
Idea stolen from: https://stackoverflow.com/a/24785578/2496717

You can save 10 bytes: <?=unpack(S,"\x01\x00")[1]-1?B:L;.

C#, 60 52 bytes
C# is surprisingly competitive in this one.
char e=>System.BitConverter.IsLittleEndian?'L':'B';

Credits to Groo for the C#6 syntax.
60 bytes:
char e(){return System.BitConverter.IsLittleEndian?'L':'B';}

With C#6 syntax you can shorten it a bit: char e=>System.BitConverter.IsLittleEndian?'L':'B';, of course this (as well as the Java answer) doesn't actually print the value.

Welcome to Programming Puzzles & Code Golf! This is a nice first answer.

Common Lisp, 27 bytes
Tested on SBCL and ECL. For a portable approach, one should use trivial-features.
(lambda()'L #+big-endian'B)

The #+ notation is a read-time condition, that reads the next form only if the conditional expression evaluates to true. Here the condition is the whole #+big-endian text which means that the test is satisfied if the :big-endian keyword belongs to the *FEATURES* list (a list which contains among other things platform-specific information). The following expression is 'B, which is either read or skipped according to the outcome of the test.
If your platform is big-endian and you write the above form in the REPL, it is exactly as if you wrote the following:
CL-USER>(lambda()'L 'B)

 (NB.CL-USER> is the prompt)
A function's body is an implicit PROGN, meaning that only the evaluation of the last expression is returned. So the above actually returns symbol ̀B.
If however the read-time condition evaluates to false, the form reads as if you wrote:
CL-USER>(lambda()'L)

... which simply returns symbol L.

Snippets are not allowed; write full programs or functions instead.

@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ Updated, thanks

Note: Snippets are only allowed if explicitly permitted by the OP.

@EʀɪᴋᴛʜᴇGᴏʟғᴇʀ Could you provide a reference for this? There are other REPL answers over here and/or shell snippets and this meta post would suggest that REPL answers could be ok by default. Thanks.

C, 34 bytes
This assumes ASCII character encoding
main(a){putchar(66+10**(char*)a);}

Call without argument.
Explanation:
On call, a will be 1. *(char*)a accesses the first byte of a, which on little-endian platforms will be 1, on big-endian platforms will be 0.
On big-endian platforms, this code will therefore pass 66 + 10*0 = 66 to putchar. 66 is the ASCII code for B. On little-endian platforms, it will pass 66 + 10*1 = 76, which is the ASCII code for L.

Julia, 24 19 bytes
()->ntoh(5)>>55+'B'

This is an anonymous function that takes no input and returns a Char. To call it, assign it to a variable. It assumes that integers are 64-bit.
The ntoh function converts the endianness of the value passed to it from network byte order (big endian) to that used by the host computer. On big endian machines, ntoh is the identity function since there's no conversion to be done. On little endian machines, the bytes are swapped, so ntoh(5) == 360287970189639680. Which is also, perhaps more readably, equal to: 0000010100000000000000000000000000000000000000000000000000000000 in binary.
If we right bit shift the result of ntoh(5) by 55, we'll get 0 on big endian machines and 10 on little endian machines. Adding that to the character constant 'B', we'll get 'B' or 'L' for big or little endian machines, respectively.
Saved 5 bytes thanks to FryAmTheEggman and Dennis!

For 32 bit you would have to change 55 to 23 (also the 5 in the 16 bit one should have been 7, my mistake). I think Dennis meant something like: ()->ntoh(5)>>55+'B'?

f()='L'-ntoh(10)%16 and f()='L'-ntoh(10)&10 should work on all platforms.

ARMv6 and later: 20 bytes machine code
0xE10F1000 : MRS   r0,CPSR        ; read current status register
0xE3110C02 : TST   r0,#1<<9       ; set Z flag if bit 9 set
0x03A0004C : MOVEQ r0,#'L'        ; return 'L' if Z clear
0x13A00042 : MOVNE r0,#'B'        ; return 'B' if Z set
0xEBxxxxxx : BL    putchar        ; print it (relative branch)

Untested, as I don't have a suitable machine to hand.  Bit 9 of the CPSR gives the current load/store endianness.

You can use a return from the function (BX lr, is it?) instead of putchar, because r0 is the proper register for returned result.

Indeed, that (actually MOV pc,lr) was in one of my previous edits.  However this fulfills the specification to print the letter, not just return it.

I may be reading the reference wrong, but I think this can be done in the "thumb 2" instruction encoding.  This would mean the first instruction remained 32 bits ("encoding T1" on page F7-2720 of the ARM v8 reference manual, which would make it 0xF3EF_8000); the second is also 32 bits (encoding the operand is a bit bizarre, but can be done with "i:imm3" set to 0010 and "imm8" to 00000010, which gives an overall instruction of 0xF010_2F02). Before the third instruction, we need to insert "ITE EQ" (0xBF0C) to control the conditions on the next two MOV instructions, which become 0x204C and ...

... 0x2042 (saving 2 bytes overall).  Then the final BL instruction is a little difficult to represent because the bits of the address which we don't know end up scattered among the bits of the instruction we do know, but it is also a 32-bit encoding, so the result would be 18 bytes total (F3 EF 80 00 F0 10 2F 02 BF 0C 20 4C 20 42 F? ?? ?? ??).  I believe this changes the architecture to ARMv8 and later, although it may work in ARMv7(?).

Perl 5, 21 + 1 = 22 bytes
Run with perl -E.
say ord pack(S,1)?L:B

Tested on amd64 (little-endian) and mips (big-endian).

Is the -E flag really necessary in the byte count? You can just say you use Perl 5.10 (since the saycommand is available in this version)

@PaulPicard No, the say command is not available in Perl 5.10 without -E.

Hmm, when I put use 5.10.0; it works... Or maybe I missed something.

@PaulPicard But use 5.10.0; is many more bytes!

Yeah but my point was if we assume that it's Perl 5.10, then there is no need for the -Eswitch or the use statement :p

@PaulPicard Your point is wrong. Perl 5.10 requires the -E switch or the use statement for say.

-E is "free" on PPCG. No need to add anything.

(however -n and -p are not)

R, 28 23 bytes
substr(.Platform$endian,1,1)

.Platform$endian returns big if run on big endian and little if on little. Here, using substr, it returns the first letter of the output, so either b or l.
As endian is the only object starting with an e contained in object .Platform we can reduce it thanks to partial matching to the following 23 bytes code:
substr(.Platform$e,1,1)

Clojure, 46 44 bytes
#(nth(str(java.nio.ByteOrder/nativeOrder))0)

This is a function that uses the Java builtin to get the endianness of the machine. Then get the string representation of it which will be either "LITTLE_ENDIAN" or "BIG_ENDIAN" and take the first character of whichever string is chosen and return that.
Saved 2 bytes thanks to @cliffroot.

What is clojure really, is it lisp or java?

@LeakyNun Maybe a practical LISP that works with Java? It's hard to say.

#(nth(str(java.nio.ByteOrder/nativeOrder))0) is 2 bytes shorter

Ruby, 3130 chars.
puts [1].pack("s")>"\01"??L:?B

Hmm, must be a better way. Count 5 characters less if the char need not to be output as I think other solutions omit printing. i.e. remove the "puts " part if you don't want anything printed.

If I remember correctly, after Ruby 1.9, you can use ?L and ?B in place of  puts :L and puts "B"

I think puts [76,66].pack("s")[0] will work.

@Sherlock9, thanks, one char less.
@WayneConrad, Perhaps add your answer, I don't have a big endian machine at hand to test but on little endian it works. But changing like this does not work: puts [76,66].pack("s>")[0]. That means it is possible to not be working on big endian for some reason I don't understand well. But this one seems to work (derived from your solution) puts [19522].pack("s>")[0]. WDYT? I wonder if I can find some place to evaluate on big endian.

Alas, I also lack a big-endian machine to test on.

Bash (and other unix shells), 32 (33) bytes
First and second attempt:
case `echo|od` in *5*)echo B;;*)echo L;;esac # portable
[[ `echo|od` =~ 5 ]]&&echo B||echo L         # non-portable

Thanks to Dennis, shorter version:
od<<<a|grep -q 5&&echo L||echo B  # non-portable
echo|od|grep -q 5&&echo B||echo L # portable

The echo utility outputs a newline, with hex value 0A, and no other output. For <<<a it is 61 0A.
The od utility, by default, interprets the input as two-byte words, zero-padded if the number of bytes is odd, and converts to octal. This results in the output of echo being interpred as 0A 00, which is converted to 005000 as big-endian or 000012 in little-endian. 61 0A becomes 005141 in little-endian and 060412 in big-endian. The full output of od also includes address and size data meaning we cannot use 0, 1, or 2 for the test.
The command is well-defined to expose the system's endianness. From the standard:

The byte order used when interpreting numeric values is implementation-defined, but shall correspond to the order in which a constant of the corresponding type is stored in memory on the system.

Compatibility notes
I am not certain if putting echo|od in backquotes with no double quotes around them [which results in a three-word argument to case] is supported on all systems. I am not certain if all systems support shell scripts with no terminating newline. I am mostly certain but not 100% of the behavior of od with adding the padding byte on big-endian systems. If needed, echo a can be used for the portable versions. All of the scripts work in bash, ksh, and zsh, and the portable ones work in dash.

None of the changes are necessary; just put one shell it works in in the language headet and you're set.

@Dennis I like doing that kind of analysis... though it's more fun if I do find something non-standard that gets a shorter answer in bash or zsh than the others. Maybe I'll see what can be done with [[

Nothing wrong with the analysis. The last paragraph just sounded like you were uncertain if a shell-specific answer is valid... od<<<a|grep -q 5&&echo L||echo B should work in Bash and others.

I tested it in a big-endian VM, and echo|od prints 0000000\n005000\n0000001 as you expected.

@user17752 Because endianness doesn't affect the output of od -a.

PHP, 16 bytes
<?=pack(S,14)^B;

This uses two tricks not used in the two existing PHP answers:

The value passed to pack() or unpack() can be anything, not just 0 or 1.
The bitwise XOR operator (^) works on strings, and the result is only as long as the shorter string, avoiding the need for a string indexing or ternary operator.

Node, 42 bytes
n=>require('os').endianness()[0]

Pro: there's a builtin. Con: property names are very long

PowerShell, 44 bytes
[char](66+10*[BitConverter]::IsLittleEndian)

Character 66 is B, and 10 characters later is number 76, L. A Boolean value of "true" becomes 1 when cast to a number. BitConverter is a standard .NET class.

Bash, 27 bytes
iconv -tucs2<<<䉌|head -c1

䉌 (U+424C) is encoded as three UTF-8 bytes: E4 89 8C.
It is assumed that iconv uses the function from glibc and that a UTF-8 locale is used.

Racket, 35 28 bytes
(if(system-big-endian?)'B'L)

'B or 'L respectively. Let me know if this is not specific enough :)

Kotlin, 42 bytes
{(""+java.nio.ByteOrder.nativeOrder())[0]}

Pretty straightforward. Uses "native" Java API. This is a lambda of () -> Char type.
String templates don't help much, unfortunately (still 42 bytes):
{"${java.nio.ByteOrder.nativeOrder()}"[0]}

Function approach (48 bytes):
fun e()=(""+java.nio.ByteOrder.nativeOrder())[0]

PHP, 22 bytes
<?=ord(pack(S,1))?L:B;

Haskell (using GHC-only size-restricted numeric types), 75 bytes
import Unsafe.Coerce
import GHC.Int
f="BL"!!fromEnum(unsafeCoerce 1::Int8)

(not tested on a big-endian architecture, but it seems like it ought to work!)

K,  15 bytes
    ("bl")@*6h$-8!`
    ,"l"

Explanation;
    From right to left;
    -8!`       /serialises the back tick and returns (0x010000000a000000f500)
    6h$-8!`    /This casts the result to `int which is type 6h(could have used `int$-8!`) - the result is (1 0 0 0 10 0 0 0 245 0i)
    *6h$-8!`   /* means first, we take the first item which is 1. Since it will be either 1 or 0, we can use it to index (@) into the two element list on the left i.e. ("bl")1 returns "l" and ("bl")0 returns b

GNU Utils, 35 bytes
lscpu|grep -o ':.*n'|grep -Eo 'L|B'

Tested on Linux kali 4.6.0-kali1-amd64 #1 SMP Debian 4.6.4-1kali1 (2016-07-21) x86_64 GNU/Linux, but I'm pretty sure the output should be fairly standard on most GNU/Linux distros.

Dyalog APL, 28 19 16 15 bytes
Both solutions below require ⎕IO←0, which is default on many systems.
In cooperation with my CTO:
'BL'⊃⍨⊃11⎕DR'⊢'

11⎕DR'⊢' interpret the character as 1 bit Boolean
  {0,0,1,0,0,0,1,0,1,0,1,0,0,0,1,0} on big-endian systems
  {1,0,1,0,0,0,1,0,0,0,1,0,0,0,1,0} on little-endian systems
⊃ pick the first number, i.e. 0 on big endian systems, and 1 on little-endian systems
'BL'⊃⍨ use that to pick from the string
This one is a bit interesting, as it requires storing in the "Classic" character set to be only 15 bytes, but must be executed in the "Unicode" interpreter to get a two byte representation. However, this is not a contradiction as the Unicode interpreter can load Classic workspaces.

Old solution:
'LB'⊃⍨'E'⎕FPROPS⎕D⎕FCREATE 0

⎕D⎕FCREATE 0 create an APL component file with the name 0123456789
'E'⎕FPROPS query endian-ness (0=little, 1=big)
'LB'⊃⍨ pick from the string

Nim, 21 20 bytes
($cpuEndian)[0].echo

Takes the cpuEndian builtin (either littleEndian or bigEndian depending on the target CPU), stringifies it with $, takes its 0th character (l or b depending on the target CPU), and uses Nim's uniform function call syntax to echo the result.

VBA, 151 Bytes
Type x
q As Long
End Type
Type z
w As Integer
End Type
Sub q()
Dim i As x, y As z
y.w=1
LSet i=y
Debug.? IIf(i.q=1,"L","B")
End Sub

Lua, 31 bytes
print(("H"):pack(19522):sub(2))

Lua 5.3 is required.

C# 50 49 bytes
Works, but has to be marked as unsafe
char i(){var a=0x0001;return*(byte*)&a>0?'L':'B';}

Updated:
unsafe char i(){int a=1;return"BL"[*(byte*)&a];}

You can use a classic trick since this is really producing 0 or 1, and index into a string to get the character "BL"[...]. Given it has to be run in an unsafe context, it should probably start with "unsafe char", and the compiler flag might need to be counted (I think it would be 1 byte, I can't remember the rules on that)... I should think you don't need any of the "0x000" stuff, "int a=1" ought to do fine.

@VisualMelon you're right, unsafe char i(){int a=1;return"BL"[*(byte*)&a];} is ok?

Yeah, that looks good (well remembered removing the space after the return, easy to miss that one)

Tcl, 46 bytes
puts [string index $tcl_platform(byteOrder) 0]

(Nothing fancy. Just in case someone wants to know how to do it in Tcl.)

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Prime Wednesdays
Prime Wednesdays
Your task is to count the number of Wednesdays that fall on a prime day of the month in a particular year. For instance, 7-13-16 is a prime Wednesday. For consistency use the Gregorian calendar for all dates.
Input
The input to your program/function will be a year (eg 2016) and is flexible. The year will be an integer between 1912 and 2233 inclusive.
Output
The output is also flexible and should be the number of prime Wednesdays (eg 18).
Scoring
This is code-golf so shortest code in bytes wins!
Test Cases

input     -> output
  --------------------
1912  ->   19
1914  ->   16
1984  ->   17
1996  ->   19
2063  ->   19
2150  ->   16
2199  ->   18
2233  ->   18

MATL, 38 36 34 bytes
FT+"@llI$YO]q&:t8XO!s9\~)9#1$ZOZps

Try it online! Or verify all test cases (takes a few seconds).
Explanation
FT+     % Input year implicitly. Add [0 1] element-wise. Gives array with input year
        % and next year
"       % For each of those two years
  @     %   Push year
  ll    %   Push 1 twice. This indicates January 1.
  I$YO  %   Convert year, month, day to serial date number
]       % End for each. We now have the serial date number for January 1 of the input
        % year and that of the following year
q       % Subtract 1 to the latter, to yield December 31 of the input year
&:      % Inclusive range between those two numbers. This gives an array of serial date
        % numbers for the whole input year
t       % Push another copy of that array
8XO     % Convert to date string with format 8. This gives weekday as "Mon", "Tue" etc.
        % The result is a 3-column 2D char array, where each row is a day
!s      % Transpose, sum of each column. 'Wed' gives 288 (sum of ASCII codes)
9\~     % 288 gives 0 modulo 9, and is the only weekday to do so. So we compute modulo 9
        % and negate. This gives true for Wednesdays, false for the rest
)       % Apply as logical index into the array of serial date numbers
9#1$ZO  % Array of month numbers corresponding to those serial date numbers
Zp      % Array that contains true for prime numbers, false for the rest
s       % Sum of array. Display implicitly

I'm convinced that MATL cannot be beaten on date-based challenges. We should create DATL which is further optimized to handle date-based challenges.

@Suever Haha, nice name

Python 2, 95 93 68 67 bytes
lambda y:0x10ea2c8dbb06c5619/5**((y+((y-22)/99-y/2002)*16)%28)%5+16

Thanks to @Josay for golfing off 1 byte!
Test it on Ideone.

You can save 1 char with 0x10ea2c8dbb06c5619 instead of 19501370182350951961.

I understand the idea of big_constant//5**long_expression but how on Earth did you come with that constant and that expression? It's crazy :D

The constant is simple a lookup table using base 5 digits, but converted to base 10, so that the digits is extracted numerically rather than using a string index. The expression looks like a perpetual calendar to me. (The problem would be too easy if it was limited to years from 1901 to 2099, as the answers repeat every 28 years within that interval, so it would be just a case of taking the year mod 28 and looking it up in the table.)

Brain-Flak, 6588, 2310, 2308, 2290 bytes
First things first, I did not write nearly 100% of this program, which is probably evidenced by the enormous size of the program.  Most of this code was written by my own Brain-Flak golfing algorithm.  Along with an additional python script I wrote to prompt it in the right direction.
Try it online!
({}<(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((()()())){}{}){})[()()])())()())[()()()()])())()()())[()()()])()())[()()()])()())[()]))())()())[()()()()])())()()())[()()()])())())[()])[()])()()())[()()])()())[()()()()])()())())[()()])())()())[()()()()])()())[()])()()())[()()])()())[()()()()])()())())[()()])())()())[()()()()])())()()())[()()()])()())[()()()])()())[()]))())()())[()()()()])())()()())[()()()])())())[()])[()])()()())[()()])()())[()()()()])()())())[()()])())()())[()()()()])())()()())[()()()])()())[()()()])()())[()]))())()())[()()()()])())()()())[()()()])())())[()])[()])()()())[()()])()())[()()()()])()())())[()()])())()())[()()()()])())()()())[()()()])()())[()()()])()())[()]))())()())[()()()()])())()()())[()()()])())())[()])[()])()()())[()()])()())[()()()()])()())())[()()])())()())[()()()()])())()()())[()()()])())()())[()()()()])()())())[()()])())()())[()()()()])())()()())[()()()])()())[()()()])()())[()]))())()())[()()()()])())()()())[()()()])())())[()])[()])()()())[()()])()())[()()()()])()())())[()()])())()())[()()()()])())()()())[()()()])()())[()()()])()())[()]))())()())[()()()()])())()()())[()()()])())())[()])[()])()()())[()()])()())[()()()()])()())())[()()])())()())[()()()()])())()()())[()()()])()())[()()()])()())[()]))())()())[()()()()])())()()())[()()()])())())[()])[()])()()())[()()])()())[()()()()])()())())[()()])())()())[()()()()])())()()())[()()()])()())[()()()])()())[()]))())()())[()()()()])())()()())[()()()])())())[()])[()])()()())[()()])()())[()()()()])()())())[()()])())()())[()()()()])())()()())[()()()])()())[()()()])()())[()]))())()())[()()()()])())()()())[()()()])())())[()])[()])()()())[()()])()())[()()()()])()())())[()()])())()())[()()()()])())()()())[()()()])()())[()()()])()())[()]))())()())[()()()()])())()()())[()()()])())())[()])[()])()()())[()()])()())[()()()()])()())())[()()])())()())[()()()()])())()()())[()()()])()())[()()()])()())[()]))())()())[()()()()])())()()())>[(((((((((()()()()())){}{}){}){}){}){}[()]){}){}){}]){({}[()]<{}>)}{}({}<{{}}>)

While this program is quite long for code golf, it really is decently short for Brain-Flak.  Currently the world record for integer division is over 1000 bytes.
Explanation
The algorithm is quite simple.  Because there is a limited number of years available (321) it simply pushes the answers in reverse order under the input and uses a lookup algorithm to find the correct answer. While hardcoding all 321 possibilities may seem rather inefficient with an task as complex as this one and a language as esoteric as brain-flak it may very well be the best solution.  (I plan to find out in the coming week).
Since most of the 321 numbers are about 18 on average and they differ by very little from year to year instead of pushing all the numbers individually I push the first year (2233) normally and then just duplicate and change the value a bit for each year after.  This way instead of paying to push ~18 for all 321 years I only pay to push ~2 for every year.
Once all the answers have been pushed it subtracts 1912 from the input ({}[(((((((((()()()()())){}{}){}){}){}){}[()]){}){}){}]) (This may be suboptimal, I rewrote the optimizer to skip certain values that I believed would not be optimal because hardcoding numbers is a super-exponential process and running it to completion may have taken a few days).
It then subtracts one from the first element and pops the second element until the result reaches zero, {({}[()]<{}>)}.
It pops the zero, {} and all the elements below the top element ({}<{{}}>).

What's the general approach to golfing numbers?

The simple idea is if you have a number with factors n and m you push n m-1 times and then pop m-1 times. The initial push evaluates as n and each pop evaluates as an additional n, making for (1+m-1)(n) which is the same as mn.  This is done recursively because in order to push n we have to golf n as well.  Since this method doesn't work well for some numbers particularly primes, we also look around to see if there is more efficient number nearby and if so we express this as the sum of that number and the difference.

I see... so given two numbers n and m which have lengths k and l, I assume n+m would have length k+l? What about n*m?

n*m would be k+4m-4 or l+4n-4.  This is because the multiplication is hardcoded.  We first push n m-1 times.  In order to do this we need k symbols in order to express n and 2m-2 symbols to express the pushes (each push is 2 symbols).  Then we pop m-1 times, costing us an additional 2m-2 (pops cost 2 symbols as well).  This totals to k+4m-4.  we can also multiply m*n (commutative property) to get l+4n-4.  The result will be the shorter of the two.

There are also other methods for golfing numbers that can get better results in some specific cases (e.g. triangular numbers).  But this is my general purpose method.

Well, if that's true, then +1 costs 2, *2 costs 4, *3 costs 8, *4 costs 12, which is more expensive than *2*2, so not worth it (out of numbers below 1000 I only found 10 that didn't use *2: 1, 2, 3, 4, 5, 9, 15, 27, 45, 135). For 1912 the best I could do was ((((((1+1+1)*2+1)*2*2+1)*2+1)*2+1)*2+1)*2*2*2 with a length of 52.

Let us continue this discussion in chat.

Bash + common utilities, 39
ncal $1|grep W|factor|egrep -c ': \S+$'

Takes the input year as a command-line parameter.  Typically outputs messages like this to STDERR - I think this is legal as per this meta-answer:
factor: ‘We’ is not a valid positive integer

If you want to explicitly suppress the STDERR output then you can do this instead for a score of 43:
ncal $1|grep W|factor 2>-|egrep -c ': \S+$'

Note that this assumes an English or C/POSIX locale.  It doesn't work so well in gd_GB.utf8, where all the day names abbreviate to Di.

Octave, 86 bytes
This is not fast, by any stretch. But that's not really the goal of a code golf, is it?
function r=p(y)r=0;for(i=698346:7:815953)d=datevec(i);r+=d(1)==y*isprime(d(3));end;end

Octave can track dates by "date number" - number of days elapsed where Jan 1, 0 is day 1. By this measure, Jan 3, 1912 (the first Wednesday in our set) is day 698,346. Start there, and iterate through every 7th day (all Wednesdays) until the end of 2233, and add 1 if the year is the target year AND the month-day is prime.

Python 2.7, 166, 165, 150 bytes
from datetime import*
y=input()
d,c=date(y,1,1),0
while d.year==y:n=d.day;c+=n>1<2==d.weekday()>0<all(n%x for x in range(2,n));d+=timedelta(1)
print c

There is certainly room for improvement here.  I am rather new to golfing in python.  This uses the datetime module.  It loops through all the days in the year adding one to an accumulator if it fits the criterion.  It then prints the result.  Most of the heavy lifting is in the module so the code can be quite slim.
One byte saved thanks to Morgan Thrapp and 15 bytes saved by Pietu1998.

You can save one byte by switching n%x==0 to n%x<1.

The -1 is not necessary as range's end index is exclusive. Additionally, you can convert the filter to a generator. [0for x in range(2,n)if n%x<1]

You could use any(...) or all(...) instead of not filter(...).

By combining chained comparisons and all you can save a whole bunch. c+=n>1<2==d.weekday()>0<all(n%x for x in range(2,n))

J, 44 bytes
+/@(valdate*3=weekday)@,.&(,/(>:,"0/p:)i.12)

I just discovered that J has builtins for date manipulation.
Usage
Extra commands are used for formatting multiple input/output.
   f =: +/@(valdate*3=weekday)@,.&(,/(>:,"0/p:)i.12)
   (,.f"0) 1912 1914 1984 1996 2063 2150 2199 2233
1912 19
1914 16
1984 17
1996 19
2063 19
2150 16
2199 18
2233 18

Explanation
+/@(valdate*3=weekday)@,.&(,/(>:,"0/p:)i.12)  Input: year
                                       i.12   The range [0, ..., 11]
                              >:              Increment each to get the months [1, ..., 12]
                                    p:        Get the first 12 primes [2, ..., 37]
                                ,"0/          Make a table between each month and prime
                           ,/                 Join the rows
                       ,.&                    Prepend the year to each
                                              The date format is YYYY MM DD
            3=weekday                         Check if each date occurs on Wednesday
    valdate*                                  and is a valid date
+/@                                           Count the number of true values and return

PowerShell v3+, 99 95 bytes
Brute force approach --
param($y)(1..12|%{$m=$_;2,3,5,7,11,13,17,19,23,29,31|?{(date "$m-$_-$y").DayofWeek-eq3}}).Count

Takes input $y, loops from 1 to 12, stores the month temporarily into $m, then loops over every prime from 2 to 31. For each of those, we construct a Get-Date of that particular day, then select only those with DayOfWeek -equal to 3 (i.e., Wednesday). Encapsulates that all in a parens to formulate an array, and takes the .Count thereof.

Alternatively, mathematical approach --
PowerShell v3+, 105 bytes
param($y)(16,19,18,20,16,18,19)[($a=(date "1-1-$y").DayOfWeek)]+(1,-3,0,1,2)[$y%5]*($a-in0,2,3,4)*!($y%4)

Winds up being just a hair longer than the brute force approach, but I'm including it here since it may be beneficial to others.
Again takes input $y as the year. This time we're performing strictly math operations based on the first day of the year. We first calculate what day of the week that is, and store that into $a for use later. That indexes into the first array, which gets us the number that is usually correct. We have to add to that a second index based on whether it's a potential leap year, whether it's a Sunday, Tuesday, Wednesday, or Thursday, and based on what the year is.
This is based on the following observation. The first column is what day of week January 1st is, the second is the usual output. Unless the year is one of the middle numbers, then it's the number in parens instead. The final column describes how the %5 indexing works.
Jan-1 -> #  ... Except if $y=       (then it's this number) | $y % 5 =
Sun   -> 16 ... 1928 1956 1984 etc. (17)                    |    3
Mon   -> 19
Tue   -> 18 ... 1924 1952 1980 etc. (20)                    |    4
Wed   -> 20 ... 1936 1964 1992 etc. (17)                    |    1
Thur  -> 16 ... 1920 1948 1976 etc. (17)                    |    0
Fri   -> 18
Sat   -> 19

Note: Both of these assume en-us is the current PowerShell setting for culture/date information. The date formatting and DayOfWeek number may need to be adjusted accordingly for other culture variants.

Ruby, 83 + 15 ( -rdate -rprime flags) = 98 bytes
Try it online! (Imported modules are inlined because idk if I can use flags in repl.it)
->y{k=0;Prime.each(31){|d|k+=(1..12).count{|m|Date.new(y,m,d).wday==3 rescue p}};k}

R, 149 147 bytes
y=function(x){s=strftime;b=ISOdate
a=seq(b(x,1,1),t=b(x,12,31),b='d')
length(a[s(a,'%u')==3&trimws(s(a,'%e'))%in%c(2,3,5,7,11,13,17,19,23,29,31)])}

Test it on Ideone.

Batch, 248 bytes
@set/ad=0,l=1,n=20
@for /l %%i in (1913,1,%1)do @set/ad=(d+l+1)%%7,l=!(%%i%%4)-!(%%i%%100)+!(%%i%%400)
@goto %l%%d%
:03
:06
@set/an-=1
:12
:13
:16
@set/an-=1
:01
:04
:14
@set/an-=1
:00
:05
:10
:15
@set/an-=1
:02
:11
@echo %n%

Explanation: d is the day of the week, with 0 for Monday, which is conveniently 1st Jan 1912. l is a flag for whether the year is a leap year, 1 for 1912. We then loop through from 1913 to the input year, updating the day of week and recalculating the leap year flag as we go. Finally we use the leap year flag and day of week to index into what is effectively a big switch statement to determine n, the number of prime Wednesdays. Setting n to 20 and decrementing it with fall though is cheaper than using flow control logic, but the upshot is that if the 1st of January of a non-leap year is Thursday or Sunday then there are 16 prime Wednesdays and so on for the other cases.

JavaScript ES6 206 203 199 197 195 183 182 179
Not the shortest, but best I can do for now... Golfing suggestions welcome...
p=n=>--d-1?n%d&&p(n):1;v=Date;D=(x,y)=>new v(x.setDate(x.getDate()-y));W=a=>eval('for(Z=0,z=D(w=new v(a,11,31),(w.getDay()+4)%7);z>new v(a,0,1);)Z+=~~p(d=z.getDate()),z=D(z,7);Z')

Changes:

altering ternary component from: 3>=x?3-x:10-x to 6-(x+10)%7, saving: 3
Changes to declaration locations;
merged x=w.getDay();z=D(w,6-(x+10)%7) to z=D(w,6-(w.getDay()+10)%7), saving: 4
shifted Z=0 from for loop to Date declaration and pushed z=D(w,6-(x+10)%7) into for loop to tidy up, saving: 2
shifted w=new Date(a,Z=0,1) declaration into for loop, merging with existing w declaration, saving: 2
rewriting the prime finding function to a prime testing function, saving: 12
changing +!! to ~~ to reduce and still convert p(d=1) from NaN to 0, allowing Prime Test function to still work, saving: 1
Moved all extra functions out of main calling function W, redefined for loop - going in reverse from 31st Dec, writing Date object out as a separate variable, then re-wrote for loop into eval call; saving 3.

@PandaCoder, I'm catching up to you, mate!

JavaScript ES6, 187 182 181 179 bytes
179 Swapped in a for-loop for the while-loop
z=y=>{D=new Date("1/3/1912");N=0;a=()=>D.getFullYear();b=()=>D.getDate();c=()=>D.setDate(b()+7);for(;a()<=y;c())N+=y-a()?0:-1<[2,3,5,7,11,13,17,19,23,29,31].indexOf(b());return N}

181 Compacted the ternary
z=y=>{D=new Date("1/3/1912");N=0;a=()=>D.getFullYear();b=()=>D.getDate();c=()=>D.setDate(b()+7);while(a()<=y){N+=y-a()?0:-1<[2,3,5,7,11,13,17,19,23,29,31].indexOf(b());c()}return N}

182 Combined the two loops
z=y=>{D=new Date("1/3/1912");N=0;a=()=>D.getFullYear();b=()=>D.getDate();c=()=>D.setDate(b()+7);while(a()<=y){N+=a()==y?-1<[2,3,5,7,11,13,17,19,23,29,31].indexOf(b()):0;c()}return N}

187
z=y=>{D=new Date("1/3/1912");N=0;a=()=>D.getFullYear();b=()=>D.getDate();c=()=>D.setDate(b()+7);while(a()<y)c();for(;a()==y;c())N+=-1<[2,3,5,7,11,13,17,19,23,29,31].indexOf(b());return N}

I don't think this counts as you've given the first initial Wednesday for the specific year, in this example. The OP's challenge states that it needs the year as the only parameter... Great effort so far though...

"The input to your program/function will be a year" -- but what you're pointing out is not that. I use the first Wednesday of 1912 as a seed because it is or is before every other Wednesday in the time period given by the OP, but I could just as easily use any arbitrary Wednesday from 1911 or before to seed it too. The input to my function is still a year, and the function still calculates the number of prime Wednesdays in any given year in the time-frame suggested by the OP, so I'm not sure how this doesn't fit the challenge.

Ah, apologies... I didn't realize at first you're using that as a seeding component... Great idea... Especially considering your solution beats mine by about 30.. ;)

Thanks. I drew inspiration from Eamon Olive's Brain-Flak implementation, which actually has all of the answers pre-programmed, according his explanation.

Groovy, 126
Groovy doesn't have prime number validation, had to build that too.
{n->p={x->x<3||(2..Math.sqrt(x)).every{x%it}};(new Date("1/1/$n")..new Date("12/31/$n")).collect{it[7]==4&&p(it[5])?it:0}-[0]}

APL (Dyalog Extended), 39 bytes
{+/1⍭2⊃¨¯1⎕DT{⍵/⍨3=7|⍵}⊃↓∘⍳/1⎕DT,¨⍵+⍳2}

Try it online!
Just that much away from MATL.
∆DT is polyfilled in this answer  because it isn't available on tio.
It was created by Adám(I simply cannot thank him enough for his help).
Explanation
{+/1⍭2⊃¨¯1⎕DT{⍵/⍨3=7|⍵}⊃↓∘⍳/1⎕DT,¨⍵+⍳2}
                                  ⍵+⍳2  year and year+1
                            1⎕DT,¨      convert each of those to their day numbers
                        ↓∘⍳/            get inclusive range between them
                       ⊃                remove nesting
             {⍵/⍨3=7|⍵}                 Wednesday filter:
                 3=7|⍵                  7 mod <daynum> always returns day of the week (starting on Monday)
              ⍵/⍨                       filter dates by that bitmask
        ¯1⎕DT                           convert the filtered day numbers to mm dd yy
     2⊃¨                                pick 2nd element of each(dd)
   1⍭                                   check if prime(1 or 0)
 +/                                     sum the array

Japt -x, 20 bytes
366õÈ=ÐUTX)f j «3aXe

Try it

Never knew japt was this good at date challenges.

@Razetime, a lot of golfing languages don't have date objects or built-ins, whereas Japt has JavaScript's ones.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
CAPTCHA Modified by Evil Mathematician
CAPTCHA Modified by Evil Mathematician
I accidentally incurred the wrath of an eccentric passive-aggressive mathematician. As part of his demented idea of payback, he modified the CAPTCHA system on my favorite website. Up until now, it would just ask a moderately challenging math question, like 3+2^4, and I would simply type the answer, 19, to verify that I am a human being. But now, thanks to my mathematical nemesis, the CAPTCHA questions are obnoxiously hard to calculate by hand and it keeps me from logging into my profile!

From what I can tell, this is what he has done. The CAPTCHA images seem to still be the same, but the way it calculates the correct answer has changed. It takes the expression displayed in the image and rotates the operations. You wouldn't believe how long it took me to figure this out T__T.
Because of this fiasco, I need a program/function that takes in one of these expressions as a string, evaluates it and returns the result so that I can log onto my website! To make this a game, fewest bytes win.
Ok, you have the idea, lets walk through an example. Suppose that the CAPTCHA displayed an image with 6+5+4-3*2/1. Normally the answer would 9. Instead, we now have to rotate the operations to the right and that gives us 6/5+4+3-2*1. At this point, we evaluate it to be 6.2
Summary
Steps to evaluate the string input:

Rotate the operation to the right
Evaluate the result

Specifications

Full program or function
Standard I/O
Takes an expression
Prints/Returns the evaluated result

After the op rotation

Possible operations are +-/*^

The negatives for negative numbers stays with the number when rotating
Follow the normal order of operations after the rotation is completed
Using integer division is allowed

Possible numbers are positive/negative integers

This does not include 0

Parentheses could be included, but aren't rotated

Test Cases
Input     -> Output
1+3       -> 4
7+6       -> 13
1+1-2     -> 2
3*4+2     -> 11
-7^4      -> -2401
3*7+1-3   -> -1
-9+4/4    -> 1.75
(4*1)+8   -> 40
1+2-3*4/5 -> -16.5
1+-2*3    -> 1
3*4--2    -> 11
30-2/7    -> 8
120*3-4+10-> 122
(13^-12)+11 -> 1

Update

[16-07-28] Fixed typo in last test case. I had posted the expression after rotating it once >___> , so that rotating a second time gave an incorrect answer. It is fixed now! Thanks to @sintax!
[16-08-13] Removed broke test case. Thanks again to @sintax!

This question seems awfully familiar to me for some reason. It's like I saw this exact same question somewhere on PPCG some time ago...strange.

Integer division allowed?

How long did it take you to derive that last equation?!

@LeakyNun Sure, the rotating of ops is the big deal here

@R.Kap That last one was a doozy, but who can say no "2 pi"?

Follow the normal order of operations after the rotation is completed Normal for math or normal for my language. I.e. can I just code the rotating part, and then do an eval?

Is 3-4*-2 a legal input and if so what is its output?

@Adám Here is the normal order of operations, your language might do it this way.

@Neil 3-4*-2 -> 3*4--2 -> 12+2 -> 14

@NonlinearFruit It might? But it doesn't!

That overload of - as a negative number indicator and the subtraction operator makes this problem much harder/longer than it otherwise would be...

@mbomb007 Actually, (-7)^4 would be 2401. -7^4 is just essentially -(7^4), which is indeed -2401.

So, what if our language does not follow the normal order of operations?

Are insignificant zeroes allowed in the output? For example, for the test case with output 11, is 11.0 an acceptable output?

Someone should do this in Evil

Dyalog APL, 30, but soon to be 16 bytes
⍎w⊣((w∊f)/w)←¯1⌽w∩f←'+-×÷'⊣w←⍞

Ungolfed, explained version:
w ← ⍞ Prompt for input (of the expression) and assign to w
f ← '+-×÷' assign the symbols to f
((w ∊ f) / w) ← ¯1 ⌽ w ∩ f using membership of f as mask, reassign those positions in w to the corresponding character in the cyclic 1-step-right rotated intersection of w and f (the symbols)
⍎w execute the modified expression
There is no special handling of minus/negative, because APL uses the distinct symbols - and ¯.
See the rotation of symbols on TryAPL!
In version 16 it will be much shorter as a function which takes the expression as argument:
⍎¯1∘⌽@(∊∘'+-×÷')

Execute ⍎ the negative one step rotation ¯1∘⌽ done on @ members of the symbols set (∊∘'+-×÷').

Python 3.5, 118 113 164 bytes:
from re import*
def R(U):Z='(?<!\d)-\d+|\d+|[()]';O=sub(Z,'',U);print(eval(sub(Z,'%s',U).translate(str.maketrans(O,O[::-1])).replace('^','**')%tuple(findall(Z,U))))

A named function. Can probably be golfed down more. This will take quite a while and apparently plenty of memory to compute the solution for the input:
((22^22)+2*2^2^2^2*2-2+222222+22222*-2222-2*222*2*2+2^-2+(2+2+2+2+2)+222/222+2+22*2*2)*2*2*2

I started processing this with my program about 30 minutes ago as of the time of this edit (9:52 PM on July 27, 2016) and it is still going. EDIT: Well, it eventually started to take up too much memory, so I had to stop it at around 1 hour after I started, at around 10:52 PM on July 7, 2016.
EDIT # 2: Well, even for the updated last test case it's pretty much the same thing, as it takes quite a while for my program to start finding the answer before it eventually quits out on me with error code 137.
Try It Online for the Rest of the Test Cases! (Ideone)

Try with the new last test case; the old one had errors.

@sintax Yeah, the same issue still persists. :/

Python 3, 195 bytes:
import re;I=input();x=[i for i in I if i in'+-*/^'];print(eval(''.join([i[0]+i[1]for i in[i for i in map(list,zip(*[[i for i in re.split('[+*/^-]',I)],x[-1:]+x[:-1]+['']]))]]).replace('^','**')))

Takes input on STDIN and leaves a number on STDOUT. I know that R. Kap already posted a Python answer, but the method I used is actually pretty interesting, so I thought I'll post this anyway.
The program first makes an the list: [chunks splitted by math chars, math chars rotated to the right]. It then transposes the array, flattens, converts to string, and evaluates.

JavaScript (ES7), 154 bytes

f=
s=>[(s=s.replace(/(\(*-?\d+\)*)(.?)/g,(_,d,o)=>a.push(d)&&o,a=[])).slice(-1),...s.slice(0,-1)].map((o,i)=>a[i]+=o)&&eval(a.join` `.replace(/\^/g,'**'))
;
<input id=i placeholder=Input><input id=o placeholder=Output><input type=button value=Go onclick=o.value=f(i.value);>

Works by removing the values into a separate array so that the operators can be rotated.

What environment can I test this in?

@Jordan I have converted my answer into a code snippet that can be tested in any ES7-compliant browser (not ES6 as previously inadvertently advertised).

Nice, you even got exponentiation to evaluate in the correct order (e.g., 2^3^2=512 rather than 64).

Matlab, 114 chars
Okay, so the last test case evaluates to Inf (once rotated, the expression 2^222222 appears...), but otherwise, all test cases hit.
Dealing with negatives, especially non-initial negatives, gave me fits.
i=input('');d=regexp(i(2:end),'[^\d|\)|\(]');d=d(~[0 d(2:end)-d(1:end-1)==1]);i(d+1)=i(1+d([end,1:end-1]));eval(i)

Inputs should be wrapped in single quotes (e.g., '2+3/5-(12*5)'), as per Matlab standard for string inputs.
Ungolfed and commented:
i=input('');                        # Get input from stdin.
d=regexp(i(2:end),'[^\d|\)|\(]');   # Find the positions of non-digit/paren characters
                                    # in the non-initial portion of the input.
d=d(~[0 d(2:end)-d(1:end-1)==1]);    # If there are consecutive operator-type characters,
                                    # assume the second is a negativity indicator and
                                    # delete its index from our list of operator indices.
i(d+1)=i(1+d([end,1:end-1]));       # Replace each non-initial operator character of the
                                    # input with its own right-rotated operator from our
                                    # list of operator characters
eval(i)                             # Evaluate the string expression we just built.

I thought that would be assumed, from the nature of the language. I can add that.
Also, yes, I mention at the top of my answer that the last test case eval's to Inf. The portion which reads '2*222222' and gets rotated to '2^222222' is too large for Matlab to store by a LOT.

Sorry, I hadn't seen that note

I'm pretty sure the example in that one case is flawed. Evaluating the rotation by hand gives 10959 + 2^888888 * 22222 which is a much larger number than is claimed.

@sintax Good catch! I have fixed that test case. The original test case had already been rotated once, so the second rotation threw it off.

Trying with the new last test case gives me: i = '((22^22)+2*2^2^2^2*2-2+222222+22222*-2222-2*222*2*2+2^-2+(2+2+2+2+2)+222/222+2+22*2*2)*2*2*2', eval(i) = 2.7314e+30; After rotating i = '((22*22)^2+2*2^2^2^2*2-222222+22222+-2222*2-222*2*2*2+-2^(2+2+2+2+2)+222+222/2+22+2*2)*2*2*2', eval(i) = 227160. Does that seem right to you?

@sintax You are correct, I created this use case by hand and didn't keep the original D: So it has been removed as a test case.


text:
Number to String
Number to String
Instructions
Convert a signed 32-bit integer to a string (base-10 preferably) without any string formatting calls (or built in type coercion that will directly convert a number to a string).
Negative numbers must include leading -.
Score Calculation
Shortest byte length; Tie breaker by efficiency (execution time)

Eh, another Do X without Y challenge.

@LeakyNun You have a problem with this challenge?

Can we turn an integer into the character of its codepoints?

How is a string formatting call defined?

String functions that are designed specifically to do exactly what the challenge is, like printf

Is toString() allowed?

Nothing that trivializes the challenge into a single function call that directly converts the value to a string (as many languages can do)

We call that a built-in.

Built-ins are fine, if they're not string formatting builtins

Can we convert single digits to string directly?

Functions that convert integers directly to a string are not string formatting builtins.

Since you very clearly understand, why not give it a shot

Then how can we convert anything to string at all? What functions are allowed? 1. can we cast an integer into a character? 2. can we convert single digits to strings directly?

Can we have a positive sign?

Casting is fine yea, but type coercion defeats the point if its doing the exact purpose of the challenge

Basically it should emulate itoa

Can we convert integer 1 directly to string "1"?

What base? 2? 10? 16? 256?

if you can do it "directly" in some way that isn't type coercion, using a mathematical approach

Is unary output okay?

If we take a string from STDIN as input can we cast it to an integer with a builtin?

Re this: itoa isn't the only function in the world.

@quartata yea that would be fine

Can we convert integers that are not the input into strings?

@NickT I was thinking base 10, though if you have something clever for another common base I would say it was fine personally

Is unary output okay?

@LeakyNun That would kind of defeat the purpose lol

Then state it clearly in your question.

Unary is base 1; so are you restricting the base?

@NickT You could do another base if you wanted, unary would just be a loop appending the digit N times so its kind of silly

Then disallow it clearly in the question.

Are leading zeroes allowed?

@LeakyNun yea, if they lead a valid result

It's a nice idea, but there are several problems with this challenge: (1) base-10 preferably: saying "preferably" doesn't make much sense here. Either force it or not. What bases are allowed? (2) without any string formattting calls is a little ambiguous. Are base conversion functions allowed, even if they output the characters representing the digits (i.e. a string)? (3) Tie breaker by efficiency (execution time): execution time varies with the computer and input. How will you exactly measure it?

JavaScript ES6, 61 57 46 45 42 bytes
Apparently this is what you want.
Apparently Leaky Nun saved me 17 bytes.
Output in binary:
f=n=>n<0?"-"+f(-n):n?f(n>>1)+"01"[n%2]:"0"

Output in decimal:
f=n=>n<0?"-"+f(-n):n<10?"0123456789"[n]:f(n/10|0)+f(n%10)

Apparently casting digits to a string is not allowed.

Apparently you can use binary.

Apparently n-a*10 is n%10.

Apparently n/2|0 is n>>1.

@LeakyNun Aprparently I had that, but I put the wrong version up :P

Apparently f(n%2) is n%2.

@LeakyNun that would be casting a number to string, which I think is against the rules

Apparently I am stupid.

Apparently f=n=>n<0?"-"+f(-n):n?f(n>>1)+"01"[n%2]:"0" works (Firefox 47.0, JS 1.5)

'Apparently' should be the name for a new programming language. Kinda similar to 'Actually', actually. ;) And lol at the "Apparently Leaky Nun saved me 14 bytes."

Jelly, 14 12 bytes

”-“”<?0³AD+48Ọ
<0”-x³AD+48Ọ

Try it online!