Sharing (characters) is Caring!

40

5

Overview

Consider the following task:

Given a positive integer n > 0, output its integer square root. The integer square root of a number n is the largest value of x where x2 ≤ n, usually expressed with the formula floor(sqrt(n)).

Examples: 25 -> 5, 24 -> 4, 40 -> 6, 1 -> 1.

This task is easy enough on its own. However, in this challenge, your task is to solve this in as many languages as possible using a set of only 25 characters.

Example

First, you need to pick a set (no duplicates) of 25 bytes. It may look something like this (note the leading space):

 ()*-.05:=>Mabdhilmnqrst|

Your challenge is then to, using only characters in this set, construct a solution to the problem in as many text based (sorry, Piet) languages as possible. You can use characters as many times as necessary, but you must not use characters outside the set.

The solutions can be either full programs or functions, but not snippets. For example, using this set of characters, I could do:

M -> (int) Math.sqrt(M)    // Java (lambda expression)
M => Math.sqrt(M)|0        // Javascript (unnamed function)
lambda M: int(M**.5)       // Python (lambda function)

As I've used 3 languages, this would give me a score of 3.

Please also include the set of bytes you are using in your answer.

Rules

  • This is a challenge - your score is the number of languages your submission includes. The highest score wins. Standard loopholes apply.
  • For this challenge, a 'language' counts as a distinctly different programming language - multiple versions of the same language (Python 2, Python 3, etc) are banned.
  • Programs only need to work for inputs within the language's standard integer range.
  • Programs with the exact same source code (polyglots) are not allowed.
  • To be more specific, it is a set of bytes, not characters - so you can use the 05AB1E £ and the Jelly ɱ as the same character (because they have the same codepoint).

Please don't feel as though you have to beat all other solutions - if you have an interesting answer, post it!

FlipTack

Posted 2017-01-09T19:14:10.043

Reputation: 13 242

2Can our solution be in Piet if we have the code be the raw ppm? (e.g. P3 10 10 255...) – Post Rock Garf Hunter – 2017-01-10T02:58:21.160

We need another pixel based language so we can have polyglots with poor old piet – MildlyMilquetoast – 2017-01-10T03:37:13.417

2Can we count a polyglot of A and B as language A if we provide another solution that only works in B? – Post Rock Garf Hunter – 2017-01-10T05:25:05.317

Could you clarify "distinctly different"? For example, is Numberwang--using digits instead of []<>.,+--- distinctly different from Brainfuck? What about SNUSP, a 2D Brainfuck derivative? For both of them, the resulting code would not work in Brainfuck.

– JungHwan Min – 2017-01-10T06:06:57.733

@WheatWizard you can't have two programs that are exactly the same, but if you modify one to be different then it's allowed. And yes, if you really must, you can use the raw ppm as "text" for Piet :P – FlipTack – 2017-01-10T07:25:33.843

@JungHwanMin the second is definitely distinctly different as it's 2D. I'd also say numberwang is sufficiently different as it has a different character set. – FlipTack – 2017-01-10T07:27:19.030

@JungHwan generally, a different language is a different creator, different syntax , etc. However with esoteric languages the line gets blurry. Trivial, "1 new command" modifications of brainfuck aren't really different to bf, but larger derivatives like the 2D one you linked encourages different ways of programming and so counts as a different language. – FlipTack – 2017-01-10T08:01:37.603

C, 23 Bytes f(x){return pow(x,.5);} and 20 characters used f(x){retun powx,.5;} – Wade Tyler – 2017-01-11T05:20:14.383

@WadeTyler Not sure why you've commented that, but you should know that you've counted x twice in your character set. Also, if you name the function something like p that's already in the set then you don't have to count f. – FlipTack – 2017-01-15T14:03:26.410

@FlipTack I wanted to make it as a post, for others who didn't use C in theirs because of reasons, and talked with someone that it would be a better idea to leave is a comment on your post so others can see it. – Wade Tyler – 2017-01-15T14:14:00.160

Answers

37

20 languages

Using  ()-#*.05;=>^Vefikloqrst (24 characters) so far:

let f l=floor(l**0.5);;       OCaml
let f l=floor(l**0.5)         F#
f(l)=floor(l^.5)              Julia
f(o)=floor(o^.5)              PARI/GP
s^+>5 0>5 0*.5l               Pyth
(* **.5).floor                Perl 6
floor.(**0.5)                 Haskell
flr.(tt ^.5)                  Wonder
l=>l**.5^0                    JavaScript
l->l**.5^0                    Cheddar
.5^5*5f                       Pyke
(isqrt)                       Maple
ri.5#i                        CJam
isqrt                         Common Lisp
0.5^k                         MATL
*.5^0                         Jelly
*.^0                          M
t0^                           05AB1E
q f                           Japt
r#                            Pushy
V-                            gs2

Lynn

Posted 2017-01-09T19:14:10.043

Reputation: 55 648

Try adding flr.(tt ^.5) for Wonder (no added chars). – Mama Fun Roll – 2017-01-10T02:24:16.433

If you would like to add {}[] you can add Brain-Flak. Here's the program

– Post Rock Garf Hunter – 2017-01-10T02:45:37.590

If you added ~, you could do sqrt~~ in Stacked; it takes input from the TOS and leaves output on the stack.

– Conor O'Brien – 2017-01-10T03:21:51.057

julia also has isqrt – rahnema1 – 2017-01-10T04:14:14.930

isqrt in Julia wouldn't count because polyglots are not allowed. – JungHwan Min – 2017-01-10T05:41:07.900

The Pyth one would be shorter and more readable if you used ttt5 instead of +>5 0>5 0. – PurkkaKoodari – 2017-01-10T12:40:01.187

C, 23 Bytes f(x){return pow(x,.5);} and 20 characters used f(x){retun powx,.5;} You can replace the curly brackets with round brackets. – Wade Tyler – 2017-01-11T05:21:40.083

Congrats on winning, enjoy the bounty! ^_^ – FlipTack – 2017-01-21T13:19:07.230

8

10 languages

Character set of 19 characters (in CP-1252):

,-/12@QUVX^fkmt¬÷␊␍

Where represents a line feed and the represents a carriage return.

(Script for checking the characters)


Jelly, 2 bytes

ƽ

Try it online!

05AB1E, 2 bytes

t1X-^

Try it online!

GS2, 2 bytes

V-

Try it online!

Jolf, 3 bytes

mfU

Try it here! (works best on Firefox)

Japt, 2 bytes

¬f

Try it here!

MATL, 3 bytes

X^k

Try it online!

Pyke, 3 bytes

,1f

Try it here!

Pyth, 6 bytes

/@Q2t2

Try it here!

Oasis, 6 bytes

1␊2/m1÷

Try it online!

2sable, 9 bytes

t1X-XX--^

Try it online!

Adnan

Posted 2017-01-09T19:14:10.043

Reputation: 41 965

cU also works in Jolf. – Conor O'Brien – 2017-01-10T03:17:55.630

@ConorO'Brien Although it's shorter, it would mean to add c to the list of characters. He's already using both m (in the Oasis sub-answer) and f (in the Japt and Pyke sub-answers). – Kevin Cruijssen – 2017-01-10T09:18:05.797

@KevinCruijssen ik, it's just for posterity – Conor O'Brien – 2017-01-10T12:29:47.720

6

5 languages

Gonna add more languages soon.

Character set (22 bytes):

s^Q.5=>*|0√Lrdmlab :/1

Pyth

s^Q.5

Javascript

Q=>Q**.5|0

Actually

√L

CJam

rdmQ

Python

lambda Q:Q**.5//1

Maltysen

Posted 2017-01-09T19:14:10.043

Reputation: 25 023

2You can replace | by ^ in your JavaScript answer to save a byte in your character set. – Lynn – 2017-01-10T02:22:40.900

6

5 languages

[].,+<>{}()0134879

18 characters.

I'm trying not to use any alphabet characters...

Brainfuck, Brainfuck++, Brainfuck-ng, Braintrust, ...

,[[>++++++[<++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++++<]>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+>]<<<[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+<<]],]>>>>>>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[<<<<<[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+>+<<]>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+>]<<+[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<+>>>>+<<]>>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<+>>]<<<<[>>[<+>>>+<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<[>+<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]>>>>>>>>+<<<<[>>>+<<[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<<]>>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+<]<[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+>]<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]>>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]<<<<<<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<++++++++++>[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++<+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++[<+<<]<[+[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>+<]<+<<]>>>>>]<<<[<++++++[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++<]>.[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++]]++++++[+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++>++++++++<]>.

Doesn't work for over 224 because 256 (= (sqrt(225)+1)^2) overflows.

Replaced all -s with +s to use one less character. (e.g. - -> 255 +s)

Original Program

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

Brain-Flak

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

@WheatWizard's code. Thanks for the permission!

Brain-Flueue

({}())(())(())({}){{}({})({}<(({})<({({})({}[()])}{})>())>)([{}]<({})>({}))({}<‌​({}<([({})]){()<({}())>}{}(<()>){({}[()])([{}]())}{}>)>)({}<({})>)({})({})}{}({}[‌​()()]){}

Another @WheatWizard's code.

Numberwang

8440999999419999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999909999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997049999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990999999999917049999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991907111499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999900911778700000009999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999994111114999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999090911704999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999190711949999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999991190000911700499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999911900711114004190009119999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997140919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970000000091111400091149999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990904999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999711700499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999909171499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999919071999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999199999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999970009999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997111111999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999199999999990499999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999919999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999994191171494999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999091719117000007111419999994999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999099999999170349999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999997799999949999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999990999999991703

Spoon

00101100010000100010111111001000110000000000000000000000000100000011010001000000101111111111011001101000100000011101000110110110110010000001001010110110011001100101100011010010010010010010010000001000110110110110110010000001010101011011001101000100000011101000110110111001000000110111010010010010101101100110100100010000001101110100100011011011011011001000100100010001110100100101011011000001101100100010101100000110110000011010010010010010010010010101101101101100100010010010101101100100000010101000100000001101101100110100100010000001010110011011001000000111010001101100001100000110100010000000110100100100000011011011011011011011000011111111111101000100000011000001000111011011001101100100100100000010101100110111011011001101001001001001000110110110110010001111111100100000010111111110110011010001010001000000011001111111100100000010111111110110011010001010

Per meta consensus, this code should be okay, even though no interpreters are currently available.

JungHwan Min

Posted 2017-01-09T19:14:10.043

Reputation: 13 290

4

5 languages

Using ()*/12 dlinpqrstu and newline (18 characters) so far.

Common Lisp

isqrt

A built-in function.

QBasic

input q
print int(sqr(q))

Python 3

print(int(int(input())**(1/2)))

Python 3 used for floating-point division without decimal points.

Pip

q**/2//1

Unnecessarily golfy to show off the unary inversion operator /. Takes input from stdin. Try it online!

tinylisp

(d sqrt (q((n nsqr input) (i (l input nsqr) (s n 1) (sqrt (s n (s 1 2)) (s 2 (s (s (s 1 n) n) nsqr)) input)))))
(q((input)(sqrt 1 1 input)))

sqrt is a helper function whose arguments are: the current guess n, n squared, and the input number. If input is less than nsqr, we've gone too far, so return n minus 1; otherwise, recurse, adding 1 to n and adding n + n + 1 to nsqr. (The math is a bit complicated because tinylisp only has subtraction built in.) The second line defines our actual function, which takes a single input and returns the result of sqrt with n starting at 1.

DLosc

Posted 2017-01-09T19:14:10.043

Reputation: 21 213

If you would like to add {}[] you can add Brain-Flak. Here's the program

– Post Rock Garf Hunter – 2017-01-10T02:51:37.783

3

6 languages

Using retun flosq(agm1)\,i and extended codepoints B1 and BC for 22 bytes so far.

GameMaker Language

return floor(sqrt(argument1))

Pyke

,1f

Julia

isqrt

Maple

(isqrt)

Stuck

i\

TI-Basic (hex dump)

B1 BC 72

Note that 0x72 is r in ASCII.

Timtech

Posted 2017-01-09T19:14:10.043

Reputation: 12 038

1

7 languages

24 chars:

limQi->(nt)Mah.sqr_ ?;:\

CJam

limQ
li       e#Read Int
  mQ     e#Integer square root

Java

i->(int)Math.sqrt(i)

Chaincode

q_
q  #sQuare root
 _ #floor

Math++

_sqrt ?

Grin

;q:

Stuck

i\)

Unilinear

iMivMiMs
i            Read input
 Mi          Convert to int
    v        Square root
    Mi       Convert to int
      Ms     Convert to String

R

sqrt

Costs too much bytes

Python

lambda i:int(i**.5)

Roman Gräf

Posted 2017-01-09T19:14:10.043

Reputation: 2 915

Can add R: sqrt – JAD – 2017-01-11T12:14:58.383