Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 30120

Code-golf is a competition to solve a particular problem in the fewest bytes of source code.

1 vote

Convert any number (up to 1e3000) to text

To get the ball rolling then, this is my version. Only the final number is converted to a float so there is no problem with large numbers if they're within range. In terms of speed, it takes about 0.8 …
Peter's user avatar
  • 215
2 votes
1 answer
681 views

Convert any number (up to 1e3000) to text

Given an input, calculate the correct suffix and output the number in a readable format in short scale (where 1 billion is 10^9). The suffixes must go to at least 10^3000, in which the rules for calcu …
Peter's user avatar
  • 215
0 votes

Output Graham's Number

PHP 214 Thought I was doing alright until I counted the characters, anyway here it is - <?function a($n,$v=" "){for($j=0;$j<$n;$j++){$r.=$v;}return $r;}for($i=64;$i>1;$i--){$b=a($i-1,"_");$v.=a(64-$i) …
Peter's user avatar
  • 215
0 votes

Input a number and return day of week

PHP - 32 Day is given as $i <?echo date('l',(($i+4)*86400));
Peter's user avatar
  • 215
1 vote

Visualize sorting

Python 2, 267 bytes It works with decimals and negative numbers as well. p=1 while p!=len(a): q=p-1;k=a[p:];m=min(k);n=k.index(m)+p;b=map(str,a) if a[q]>m:print','.join(b)+'\n'+''.join(' '*len(i …
Peter's user avatar
  • 215
0 votes

The Real Slim Shady

PHP: 176 Thought I might as well give it a shot, nothing fancy though $b="I'm ";$c="Slim";$d="Shady";$e="$c $d";$f="the real ";$g="lease stand up";echo"$b$e. Yes, $b$f$d.\nAll you other $e"."s are jus …
Peter's user avatar
  • 215
0 votes

What's my type? Well... Probably

Python 2, 1022 bytes, 100% I generated a hash of each name and only recorded the unique first characters, then for the types I used bitwise operations. It didn't work as well as I'd have hoped but her …
Peter's user avatar
  • 215
2 votes

Hexagonal maze time!

Python 2, 703 bytes Not as good as the other two versions, but at least it works haha. Set M to the maze. Since I have no experience at solving mazes, it just goes by a brute force approach, where it' …
Peter's user avatar
  • 215
1 vote

Maximise the squared difference

Python 2, 100 I know there's already a python answer, but I think I may have done this differently. n=input();a=n%2;b=n/2;x=[b+1,b+a][a:] for i in range(b+a-1):f=1-i%2*2;x=[x[-1]-f]+x+[x[0]+f] print x …
Peter's user avatar
  • 215
2 votes

Convert English to a number without built-ins or libraries

Python 2, 275 characters def x(n):a='one two three four five six seven eight nine ten eleven twelve'.split();t='twen thir four fif six seven eigh nine'.split();b=[i+'teen'for i in t[1:]];c=[i+'ty'for …
Peter's user avatar
  • 215