[Question]
  [
# Challenge
Write a program or function that takes a number \$n\$ and returns the smallest \$k\$ such that concatenation \$n'k\$ is a square. This sequence is described by [A071176 on the OEIS](https://oeis.org/A071176).
# I/O Examples
```
input --> output
1   -->    6 (4^2)
10  -->    0 (10^2)
35  -->  344 (188^2)
164 -->  836 (406^2)
284 --> 2596 (1686^2)
```
# Rules
* Input will always be a positive decimal integer
* Output will be a positive decimal integer with no leading `0`'s or `0`
* [Standard I/O rules](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods) apply
* No [standard loopholes](https://codegolf.meta.stackexchange.com/questions/1061/loopholes-that-are-forbidden-by-default)
* This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"), so shortest code in bytes wins
  
[Answer]
# [05AB1E](https://github.com/Adriandmen/05AB1E/wiki/Commands), 7 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
∞<.Δ«Å²
```
[Try it online](https://tio.run/##yy9OTMpM/f//Ucc8G71zUw6tPtx6aNP//0YWJgA) or [verify all test cases](https://tio.run/##ATsAxP9vc2FiaWX/dnk/IiDihpIgIj95wqn/4oiePC7OlMKuc8Krw4XCsv99LP9bMSwxMCwzNSwxNjQsMjg0XQ).
# [05AB1E (legacy)](https://github.com/Adriandmen/05AB1E/tree/fb4a2ce2bce6660e1a680a74dd61b72c945e6c3b), 8 [bytes](https://github.com/Adriandmen/05AB1E/wiki/Codepage)
```
[N«Å²#}N
```
[Try it online](https://tio.run/##MzBNTDJM/f8/2u/Q6sOthzYp1/r9/29kYQIA) or [verify all test cases](https://tio.run/##ATcAyP8wNWFiMWX/dnk/IiDihpIgIj95wqn/W8KuTsKrw4XCsiN9Tv8s/1sxLDEwLDM1LDE2NCwyODRd).
Alternative 8-byter which works in both 05AB1E versions (credit to *@Grimmy*):
```
[N«Å²iNq
```
[Try it online](https://tio.run/##yy9OTMpM/f8/2u/Q6sOthzZl@hX@/29kYQIA) (no test suite due to the program terminate `q`).
**Explanation:**
```
∞         # Push an infinite list in the range [1, ...]
 <        # Decrease each by 1 to make the range [0, ...]
  .Δ      # Find the first value which is truthy for:
    «     #  Concat the value to the (implicit) input-integer
     Å²   #  And check whether it is a square number
          # (after which this found first value is output implicitly as result)
[         # Start an infinite loop:
 N«       #  Concat the 0-based loop index to the (implicit) input-integer
   Å²     #  If it's a square number:
     #    #   Stop the infinite loop
}N        # After the infinite loop has stopped: push the last index
          # (after which this found index is output implicitly as result)
[         # Start an infinite loop:
 N«       #  Concat the 0-based loop index to the (implicit) input-integer
   Å²i    #  If it's a square number:
      N   #   Push the index again
       q  #   And terminate the program
          #   (after which this index is output implicitly as result)
```
The legacy version didn't had the `∞` builtin, and in the new version it isn't possible to push the last index `N` after a loop is terminated, which is why I decided to post both solutions.
[Answer]
# [Perl 6](https://github.com/nxadm/rakudo-pkg), 23 bytes
```
{(0...($_~*)**.5%%1)-1}
```
[Try it online!](https://tio.run/##K0gtyjH7n1upoJamYPu/WsNAT09PQyW@TktTS0vPVFXVUFPXsPZ/cWKlgh5QRVp@kYKhjoKhgY6CsSmQNjPRUTCyMPkPAA "Perl 6 – Try It Online")
### Explanation
```
{                     }  # Anonymous codeblock
 (0...             )-1   # Find the first number
      ($_~*)             # That when appended to the input
            **.5         # Has a sqrt
                %%1      # That is whole
```
[Answer]
# [J](http://jsoftware.com/), ~~27~~ 21 bytes
```
(]+0<1|2%:,&.":)^:_&0
```
[Try it online!](https://tio.run/##y/qvpKeepmBrpaCuoKNgoGAFxLp6Cs5BPm7/NWK1DWwMa4xUrXTU9JSsNOOs4tUM/mtypSZn5CuYKdgqpCkYQjgGEI4BhGdsYgLmG5tC@BbGUMVmJhABI1NLiIiRhcl/AA "J – Try It Online")
*-6 bytes thanks to FrownyFrog*
* `( )^:_` invoke the verb in parens continuously until it's output stops changing
* `&0` set the right argument -- the one that will change each iteration -- to 0 (the left argument, the input, will remain fixed)
Now let's break down what's in the parens
* `]+` the right arg plus...
* `0<` 0 or 1, depending on if 0 is less than...
* `1|` the reminder when 1 divides...
* `2%:` the square root of...
* `,&.":` the left arg (original input) catted with `,` the right arg "under" `&.` stringification `":`: ie, turn them both into strings, cat them, then convert back to an int
[Answer]
# JavaScript (ES7), 33 bytes
Takes input as a string.
```
f=(n,k=0)=>(n+k)**.5%1?f(n,k+1):k
```
[Try it online!](https://tio.run/##y0osSyxOLsosKNHNy09J/f8/zVYjTyfb1kDT1k4jTztbU0tLz1TV0D4NJKptqGmV/T85P684PydVLyc/XSNNQ91QXVOTC13MAIugsSk2lWYmWESNLECi/wE "JavaScript (Node.js) – Try It Online")
[Answer]
# [R](https://www.r-project.org/), 45 bytes
```
n=scan();while((paste0(n,+F):1)^.5%%1)F=F+1;F
```
[Try it online!](https://tio.run/##K/r/P8@2ODkxT0PTujwjMydVQ6Mgsbgk1UAjT0fbTdPKUDNOz1RV1VDTzdZN29Da7b@hmcl/AA "R – Try It Online")
Throws a warning for each iteration noting that it only uses the first element of the vector as a loop condition. This will run out of space for large inputs since it constructs a vector of length \$n'k\$ at each iteration; [this version](https://tio.run/##K/r/P8@2ODkxT0PTujwjMydVo7ikqCQ/U6Mgsbgk1UAjT0fbTVMzTs9UVdVQ083WTdvQ2u2/odl/AA) will work for larger inputs and should be a bit faster, at a cost of 4 bytes.
[Answer]
# [Perl 5](https://www.perl.org/) `-pal`, 30 bytes
```
$_=0;$_++while"@F$_"**.5=~/\./
```
[Try it online!](https://tio.run/##K0gtyjH9/18l3tbAWiVeW7s8IzMnVcnBTSVeSUtLz9S2Tj9GT///f0MuQwMuY1MuQzOTf/kFJZn5ecX/dX1N9QwMDf7rFiTmAAA "Perl 5 – Try It Online")
[Answer]
## C, ~~123~~ 115 bytes (thanks, Jo King!)
```
n,k,m=10,x,p;main(){scanf("%d",&n);for(;k<m||(m*=10);++k)for(p=0;x=n*m+k,p<=x;++p)if(p*p==x)return printf("%d",k);}
```
I noticed this version can fail on not-very-large inputs due to integer overflow. So I, did a separate version, with less overflow.
## C, less overflow. 117 bytes
```
n,k,m=10,x,p;main(){scanf("%d",&n);for(;k<m||(m*=10);++k)for(p=0;x=n*m+k,p*p<=x;++p)if(p*p==x)return printf("%d",k);}
```
## Pretty Printed:
```
n, k, m = 10, x, p;
main() {
    scanf("%d", &n);
    for (; k < m || (m *= 10); ++k)
        for (p = 0; x = n * m + k, p * p <= x; ++p)
            if (p * p == x)
                return printf("%d", k);
}
```
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 8 bytes
```
;.c~^₂∧ℕ
```
Sadly enough it takes 3 bytes to check if a number is square and an extra `ℕ` is needed if the input is a square itself.
## Explanation
```
;.c~^₂∧ℕ     # Find a value
;.c          #   that concatenate to the input
   ~^₂       #     gives a square number
      ∧ℕ     # and make sure that value is a number 
             #   (otherwise we get the empty list for inputs that are square)
```
[Try it online!](https://tio.run/##SypKTM6ozMlPN/r/31ovuS7uUVPTo47lj1qm/v9vZGHy3xEA "Brachylog – Try It Online")
[Answer]
# [Python 2](https://docs.python.org/2/), ~~47~~ 49 bytes
```
f=lambda p,i=0:int(`p`+`i`)**.5%1and f(p,i+1)or i
```
[Try it online!](https://tio.run/##K6gsycjPM/r/P802JzE3KSVRoUAn09bAKjOvRCOhIEE7ITNBU0tLz1TVMDEvRSFNAyirbaiZX6SQ@b@gCKgIKGRoZqL5HwA "Python 2 – Try It Online")
[Answer]
# [C++ (clang)](http://clang.llvm.org/), ~~194~~ \$\cdots\$ ~~128~~ 129 bytes
```
#import<string>
#define z std::to_string
int f(int n){for(int j=-1;;)for(long i=0,m=stol(z(n)+z(++j));i++<m;)if(i*i==m)return j;}
```
[Try it online!](https://tio.run/##PY7daoQwEIXvfYrBvTFVQdvdUkz0SQpFNC4jJpE49kLx2e2oSy/m9wxnvmYc02ao7XPfb2hG50lN5NE@q@DW6g6thgUmaouC3M@lBGgJuujIVqyd82fbl2kupTjGwdknYJklppzIDdESWREvURz3QkiMY2WkQDZ4w7I0wmuavYVebkxgm2FuNSh0/EvXhin@d7@6Ieer872p0UZiDeBiuyTFSgWkJ5rWPMmz5OOR5J/35P3rvkk@ZTY4WbE4jwTv4OXQuJlAKUCOENK04swtU4qjht82PCxesJkMtv0P "C++ (clang) – Try It Online")
Added a byte to fix overflow error kindly pointed out by [Deadcode](https://codegolf.stackexchange.com/users/17216/deadcode).
[Answer]
# [Python 3](https://docs.python.org/3/), 51 bytes
```
f=lambda n,i=0:int(f'{n}{i}')**.5%1and f(n,i+1)or i
```
[Try it online!](https://tio.run/##HYzBCoMwEETv/Yq9FBMbJKlaiuDHpNXQBbMJSXoQ8dvTpQPz5vBg4l4@gfqKPoZUIO/5wu3yWtL6/qaMgTb0WITRHFndvFn/WiyQwllPSEW45qDzwLORbduNV2NpASfY34wMCbA6JgESGAVGK@hH3seg4P4cJojpfyJIyvoD "Python 3 – Try It Online")
[Answer]
# [Ruby](https://www.ruby-lang.org/) -pl, 43 bytes
```
i=1;i+=1until"#{i*i}"[/^#$_(?!0.|$)/]
$_=$'
```
[Try it online!](https://tio.run/##KypNqvz/P9PW0DpT29awNK8kM0dJuTpTK7NWKVo/TlklXsNe0UCvRkVTP5ZLJd5WRf3/f0MuQwMuY1MuQzMTLiMLk3/5BSWZ@XnF/3ULcgA "Ruby – Try It Online")
Tests each square until it finds one that starts with the input and is followed by a number with no leading zero. I thought going in this direction rather than the more natural one would be shorter, but now I'm doubting that it is.
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~18~~ ~~16~~ ~~15~~ ~~11~~ 10 bytes
Uses the floating point square root test, like most of the other answers. As such, the precision is eventually insufficient, and the smallest square it fails with is `4503599761588225` – with an input of `45035997`, it [returns `61588224`](https://tio.run/##K6gsyfhvG2VmaGoAAv@VPRVVHYq1AxOijBQMo5xsM6L@/zcxNTA2tbQ0/5dfUJKZn1f8X1c3tzSnJDMnMy8VyE5JTSpNBwA) instead of `61588225` as it should. The smallest input it fails with is `20256971`, [returning `228498166`](https://tio.run/##K6gsyfhvG2VkZGFiAAL/lT0VVR2KtQMToowUDKOcbDOi/v83MjAyNbM0N/yXX1CSmZ9X/F9XN7c0pyQzJzMvFchOSU0qTQcA) instead of `228498169` as it should. This is due to IEEE 754 floating point not being able to store precise integers greater than 252.
```
fsI@s+zT2Z
```
[Try it online!](https://tio.run/##K6gsyfhv615c5RYZ7G4bZVCgbVuVEKlkpaD0P63Y06FYuyrEKOr/f2NTg3/5BSWZ@XnF/3V1c0tzSjJzMvNSgeyU1KTSdAA "Pyth – Try It Online")
Ungolfed:
```
z = input()
Z = 0
for T in __import__('itertools').count(Z):
  tmp = int(z + str(T))**0.5
  if int(tmp) == tmp:
    print(T)
    break
```
Token by token explanation:
```
fsI@s+zT2Z
f            # (Implicitly print) First value of T for which the following is true:
         Z   # where T iterates over [Z, Z+1, Z+2, ...] with Z=0
     +zT     # the (string, since one of them is a string) concatenation of z and T
    s        # Converted from string to integer
   @    2    # To the 1/2 power
 sI          # is Invariant under floor conversion to integer
```
# [Packed Pyth](https://github.com/isaacg1/pyth/blob/master/packed-pyth.py), 9 bytes
Hex dump: `CD CE 4C 0E 6A FD 54 65 68`
[Try it online!](https://tio.run/##XY6xCsIwAERnO/gNRxGiQ1pjq4h2cnByrKBjm0QShaTEain4C/pHTv2wakFQ3O5x3OPy7KxaJzMB6kAFCIFLErKqqlMeXfZ1vUvVrFKkbe7NY9M/Ns9Uqva/9oq6VNZECG1Rhh2ERcZPUtAuB0UNekEylFxZUAN/4HzcoLk1V9ADtumazkFLbNgIAbdCBt3OO1gHDW3AwMaIpmCzGJN5vISwXu9r0wv4Xx7ot/vnyOfBj1dYI9sX "Packed Pyth – Try It Online")
[Answer]
# [Pyth](https://github.com/isaacg1/pyth), ~~35~~ ~~33~~ ~~30~~ ~~23~~ 21 bytes
This is a program that uses only integer arithmetic. Since Python has arbitrary-precision integers, this is guaranteed to work for arbitrarily large numbers, whereas the square-root test used by most of the other answers fails with numbers greater than 252, having false positives with numbers very close to a perfect square.
Assumes that the input has no leading zeroes.
```
 f&J>K`*TTlzq+z`sJK)J
```
[Try it online!](https://tio.run/##K6gsyfhv615c5RYZ7G4bZVCgbVuVEKlkpaD0XyFNzcvOO0ErJCSnqlC7KqHYy1vT6/9/Y1ODf/kFJZn5ecX/dXVzS3NKMnMy81KB7JTUpNJ0AA "Pyth – Try It Online")
The leading space is needed to suppress printout of the value of `T` that resulted in loop termination, since `f` returns that value.
Ungolfed:
```
z = input()
for T in __import__('itertools').count(1):
    K = str(T*T);
    J = K[len(z):]
    if len(J)!=0 and z+str(int(J))==K:
        break
print(J)
```
# [Packed Pyth](https://github.com/isaacg1/pyth/blob/master/packed-pyth.py), 19 bytes
Hex dump: `41 99 34 A7 D2 F0 2A A9 53 67 AE 2A FD 60 E7 2A 5A 99 40`
[Try it online!](https://tio.run/##XY5BasJAAEXX5hSfIEQDk5gmlaBZtF105U4L1ZUxM3aGwEyYxoaAp3DnCaSb0gt0MzlYakBQ3P0H/z/@Jv3krWYpBdEgFI4DnSTOS1Xlm3C3rOv3BR9X3GmfzTEyp@bQ/Lrme/5hftzmb92c3JU5PrX3dauoS65kCF8Vpd@BX6RZzijpslfUIDskA5ZxBSJh97WNPUSm5BfIFm@LVxKDlJgFQ3iZoszrdtZWaQgIiQDBCOEjgnGEhziagiqrd7WJCewr98XZfXPk8uDGS5Vk7T8 "Packed Pyth – Try It Online")
[Answer]
# [Burlesque](https://github.com/FMNSSun/Burlesque), 28 bytes
```
sajpsq~!_+2R@)S[jfeupjq[-jE!
```
[Try it online!](https://tio.run/##SyotykktLixN/f@/ODGroLiwTjFe2yjIQTM4OisttbQgqzBaN8tV8f9/QwMA "Burlesque – Try It Online")
Pretty sure this could be shorter, a lot of work is trying to drop N letters. 
```
sa       #Find the length of the input to know how many characters to drop 
j        #Put at bottom
ps       #Parse the string to {int}
q~!      #Boxed "starts with"
_+       #Concatenate to make {int !~} "starts with int"
2R@      # 2...inf
)S[      #Infinite list of squares
jfe      #Find an element that starts with int
up       #Turn int to string
jq[-jE!  #Drop (length of int) characters leaving the tail
```
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 10 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
@s+X ¬v1}a
```
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=QHMrWCCsdjF9YQ&input=Mjg0)
[Answer]
# [PHP](https://php.net/), ~~53~~ ~~47~~ 44 bytes
```
for($k=-1;fmod(sqrt($argn.++$k),1););echo$k;
```
[Try it online!](https://tio.run/##K8go@G9jX5BRoMD1Py2/SEMl21bX0DotNz9Fo7iwqERDJbEoPU9PW1slW1PHUNNa0zo1OSNfJdv6/39DM5N/@QUlmfl5xf913QA "PHP – Try It Online")
[Answer]
# [Japt](https://github.com/ETHproductions/japt), 10 [bytes](https://en.wikipedia.org/wiki/ISO/IEC_8859-1)
```
_siU ¬%1}f
```
Saved a byte thanks to @AZTECCO
[Try it](https://petershaggynoble.github.io/Japt-Interpreter/?v=1.4.6&code=X3NpVSCsJTF9Zg&input=WzEsMTAsMzUsMTY0LDI4NF0KLW0gLVI)
[Answer]
# [K (ngn/k)](https://codeberg.org/ngn/k), ~~21~~ 19 bytes
-2 bytes from @ovs's simplification
```
{(1!%.,/$x,)(1+)/0}
```
[Try it online!](https://ngn.codeberg.page/k/#eJw9z9FqwyAUBuB7n8JBBwmrVRMjNsJepHTUOdOEJtpGhZTSPfs0G/PmHD9/L/6ufRT05XW3xZtlWxb0rcTkCUBoH5vD/XtuOwjhIk/uIotTp4ZRLvIu5/L4BOFAJT/mQSTJs25kzdgqnElRr4+VYLJq9mkHGPQhXH2LsXZf5uzGbueD0hez6F7Zs9lpN+FbND4MznpM94JWFPtJjWMyZOP0aWbko+5R6FVA2lmtgrEq59HgkUL+FtVsABjsNQaI0Dt0MaQVAJp65Hs6HBbsoyoBJf9EYEFJtrr5s9QkmRBrkLNfTJ3SX8IzpmIr5nIpyUXWH4ZRWvo=)
* `(cond)(code)/seed` set up a while-reduce, seeded with `0`, running the `(code)` clause until the `(cond)` clause returns a non-truthy value
	+ `(1+)` code that increments its input
	+ `(1!%.,/$x,)` the condition/check
		- `.,/$x,` append the current iteration value to the original input, convert each to a string, combine them, and eval the result (this converts the result to an integer)
		- `1!%` check if the remainder of the square root of the iteration value is non-zero
[Answer]
# JavaScript (Node.js), 38 Bytes
[Try it Online!](https://tio.run/##y0osSyxOLsosKNHNy09J/Z9m@18jUSfJNtogVtPWTiNRO0lTS0vPVNXQPg0oHq2tnRSraaWd9D85P684PydVLyc/XSNNw1BTkwtNxABDyNgUU5WZCYaYkQVQ7D8A)
```
f=(a,b=[0])=>(a+b)**.5%1?f(a,[++b]):+b
```
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 8 bytes
```
0ṭVÆ²ɗ1#
```
[Try it online!](https://tio.run/##y0rNyan8/9/g4c61YYfbDm06Od1Q@b/1o4Y5Crp2Co8a5lofbuc63P6oaU3k///RhjpchgY6XMamQNrMRIfLyMIkFgA "Jelly – Try It Online")
A monadic link taking as its argument an integer and returning an integer. 
## Explanation
```
0    ɗ1# | Starting with zero, find 1 integer where the following is true as a dyad, using the original argument as the right argument
 ṭ       | - Tag onto the end
  V      | - Evaluate after converting to string and concatenating
   Æ²    | - Check if perfect square
```
[Answer]
# [Perl 5](https://www.perl.org/), ~~35~~ 40 bytes
```
$k=0;L:$_="$n$k"**.5;!/\./ or$k++,goto L
```
[Try it online!](https://tio.run/##DcPdCoMgGADQe5/im3xBf1YuHWPOnqBHCLoYtcKmYsEuxp7d7cDxU9hkfC/rNkF67zL4EIDH4l4@RatxzFREoxvV33DUFC0amueVVKd6qGpwAU1RlE93OOij8mG1xww0Ye0OjHWQiH2wtAS0/wa@kRPekFYSfhHkfBU/ "Perl 5 – Try It Online")
[Answer]
# [cQuents](https://github.com/stestoltz/cQuents), 13 bytes
```
#|1:#bA~N
?$$
```
[Try it online!](https://tio.run/##Sy4sTc0rKf7/X7nG0Eo5ybHOj8teReX/f2NTAA "cQuents – Try It Online")
## Explanation
```
#|1         output nth element in sequence (remove to output indefinitely)
   :        mode: sequence, output nth element in sequence
    #       conditional: count N up, when true, add to sequence
     b      call second line, passing 
      A~N                             input concatenated to N
?$$         second line - sequence of squares - return true if a square and false if not
```
[Answer]
# [Charcoal](https://github.com/somebody1234/Charcoal), 16 bytes
```
≔⁰ηＷ﹪₂Ｉ⁺θη¹≦⊕ηＩη
```
[Try it online!](https://tio.run/##S85ILErOT8z5/9@xuDgzPU/DQEchQ9OaqzwjMydVQcM3P6U0J18juLA0sSg1KD@/RMM5sbhEIyCntFijEKRSU1NHwVBTU8E3sQBqgGdeclFqbmpeSWoKxKiAosw8qD6geuv//40sTP7rluUAAA "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
```
≔⁰η
```
Initialise the result to zero.
```
Ｗ﹪₂Ｉ⁺θη¹
```
Repeat until the concatenation is a square.
```
≦⊕η
```
Increment the result.
```
Ｉη
```
Output the result.
36 bytes for an efficient solution:
```
≔×χＮη
```
[Try it online!](https://tio.run/##jc6/CsIwEAbw3afIeIEIWhyETlJQBJXS@gKxhuQgTdr8sY8fU8Wlk8sNx3e/@zrFXWe5TungPUoDd@yFh@2GkbMZYrjF/iEcUMqIouXqyodvrkGpAtQ6ekZOTvCQQ@0YuRONtQFUzh@1tYvlj5kUakHgiOYJFfcZslMGKoEajVzcMFLMY6SULN5/ujIyl53V2qEJ0GrsxN/qRRgZFGSclikV@11av/Qb "Charcoal – Try It Online") Link is to verbose version of code. Explanation:
Multiply the input by 10.
```
≧⁺›₂η⌊₂ηη
```
Increment it unless it is already a square number.
```
Ｗ⌕ＩＸ⌈₂η²θ
```
Repeat until the square ceiling square root begins with the original input.
```
≧×χ
```
Multiply by 10.
```
η✂ＩＸ⌈₂η²Ｌθ
```
Output the suffix of the square ceiling square root.
[Answer]
# [GolfScript](http://www.golfscript.com/golfscript/), 24 bytes
I don't feel right to have a Burlesque answer without a GolfScript answer.(Please don't mind if this is a little bit slow, although they seem to produce the right result.)
```
-1{).2$\+~.),{.*}%?)!}do
```
[Try it online!](https://tio.run/##S8/PSStOLsosKPn/X9ewWlPPSCVGu05PU6daT6tW1V5TsTYl//9/QwMjAA "GolfScript – Try It Online")
## Explanation
```
-1                       # The counter for the current number (it is >= 0)
  {                      # Do at least 1 time until the number is a square number
   )                     #     Increment the counter
    .                    #     Copy the counter (to create an integer)
     2$                  #     Extract the 3rd-to-top to the top
       \                 #     Make sure that the casting to string works
        +                #     Join the numbers, as well as converting the
                         #     right operand to a string (input+count)
         ~               #     Evaluate the string to get a number
          .              #     Copy the number for the square number check
           ),            #     Generate range from 0 to the number
             {.*}%       #     Apply square for every number
                  ?      #     Find out where the number is inside the sequence
                         #     (yields -1 for nonexistent)
                   )     #     Increment, to make nonexistent false and others true
                    !    #     Negate, which means we shouldn't find the first non-square number.
                     }do # End do loop, use TOS as condition
                         # Output the counter at the end
```
```
[Answer]
# AWK, 29 bytes
```
{while(($0x++)^.5%1);$0=x-1}1
```
Works with `mawk`, `gawk` and `nawk` on macOS and Ubuntu but not with [TiO](https://tio.run/##SyzP/v@/ujwjMydVQ0PFoEJbWzNOz1TVUNNaxcC2Qtew1vD/f0MA "AWK – Try It Online") for some reason.
[Answer]
# [RProgN 2](https://github.com/TehFlaminTaco/RProgN-2), 13 bytes
```
x={x\.nš1%¬}é
```
# Explanation
```
x={x\.nš1%¬}é   #
x=              # Set 'x' to the input.
  {        }é   # Run the enclosed function with raising integers untill it returns truthy, and spit out that number
   x\.          # Place the input under the current number and concatenate them together
      nš        # Convert to a number and get the square root
        1%¬     # Is this a whole number?
```
[Try it online!](https://tio.run/##Kyooyk/P0zX6/7/CtroiRi/v6EJD1UNrag@v/P//v5GFCQA "RProgN 2 – Try It Online")
[Answer]
# Java, ~~75~~ ~~63~~ 61 bytes
Two bytes less thanks to [Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen).
And another two less in the second version again thanks to [Kevin Cruijssen](https://codegolf.stackexchange.com/users/52210/kevin-cruijssen)!
```
n->{int j=0;for(;Math.sqrt(new Long(n+j))%1>0;j++);return j;}
```
[Try it online!](https://tio.run/##LY7BisIwFEXX7Ve8jZDQMVQY3EQLboSBmZVLcRFrWpOpLzF5cRDpt2cqurtwLpxj1U3NnddoT7@5HVSMsHmURSRFpgU7UZHIDKJL2JJxKLbvsdpRMNh/wBeS7nVooIN1xnnzMEhg17XsXGDyR9FZxGsghvoPvh32DCvL@WzR1NJWFZdBUwoIVo5Zlj4dh8n71t@cOcFFGWQv2f4AKvSRT4HF7h5JX4RLJPzEiHVCeT/c2fOxrw@cy7IYyzHnxfLzHw)
I also have another version with my first (and very different) approach, which is ~~107~~ ~~92~~ ~~93~~ 91 bytes long:
```
n->{String a;for(long i=4;!(a=i*i+++"").matches(n+"([1-9].*|0)"););return a.split(n,2)[1];}
```
[Try it online!](https://tio.run/##LY5BasMwFETX9ikUr6Q4FnEJhaI60E0vkKXx4texEzmyJKSvQEh9dlXFWc0MMzBvgjtUxg56Ot9ir8B78vXMM4@AsidTanlAqfgYdI/SaP79Mp8ndFJfdmTVIxlJE3V1fK6ZgBiNo8okK5uD2FBo5FaWZVkUjM@A/XXwVJcFbevqo@Pb3z0rmGDCDRicJsC9VRKp3r2xtu7EEkVuw49KUC@2u5FnMoPUdH1sOwLu4lmiz04Pj8PMTUBuU4d05GCtetD/RbvvGBN5tuRLjPX74Q8)
Both version have been tested against the first [10000 numbers](https://oeis.org/A071176/b071176.txt).
[Answer]
# [Haskell](https://www.haskell.org/), ~~93~~ 88 bytes
```
[j|i<-(show.(^2))<$>[0..],i/=n,n`isPrefixOf`i,j<-[drop(length n)i],j=="0"||j!!0/='0']!!0
```
[Try it online!](https://tio.run/##PY1BT4NAEIXv@yumxKaQwBZaNB6gF/WmsUm9EUw3ssggzJLd1daIvx2BqLeX75t5rxLmTTbNgG2ntIUbRVarhj8oEgW4tULy2K@7FVbwezT2Dxw@jZUtv6MP1IpaSf/mSZ4t32skWzLWCiRIoVAMoJEWytbCBLrZg7MMtgaCYAfL2DijcUsYRwFGK7V4seC@U4MkDXBoRTf/c5jJdHaqpJbwBeVUOmR1j0ngmkqduPu88bzkYpeFnOc@rlPy6Yhmr2WJ58fyiH6dBFmhVec2kl5tNe5i7tdp6oRO39eLRbhOV@EqH8PwPUQsCtn2kkVXMdtcxz8 "Haskell – Try It Online")
[Answer]
# [PHP](https://php.net/), ~~83~~ 86 bytes
```
g:substr($k=$i*++$i,0,$l=strlen($n=$argn))==$n&&("$k")[$l]&&die(substr($k,$l));goto g;
```
[Try it online!](https://tio.run/##PctBCsIwEAXQq5TyCRlboW6tgzsvIS4qljQ0TIYmXr9jV24fPF3UbnddtLFwLd93qZvHyoinrkPshx6JD0uzeAhj2oIQMUOc8y3Wlp5IL@c@cfb/fRyiMeSamzCaXYY9a41Zip0fPw "PHP – Try It Online")
-9 bytes thanks to @640KB and bugs fixed (+12). Only fails for case 10 currently.
## Ungolfed
```
<?php
$number=$argv[1];
$len = strlen($number);
$i=0;
do {
    $k = $i*$i;
    if (substr($k,0,$len)==$number && substr($k,$len,1)!='0') {
        die(substr($k,$len));
    }
    $i++;
} while (true);
?>
```
[Try it online!](https://tio.run/##VY3BDoIwEETv@xVrsoFWOJRzrXyI8SChygbEpoAeDN9ei5AY57S7b2bWNS6EQ@kaB0D9dK@sN3Txt@epOGugzvZocBh9HMTGZbyzURrqB74Bo6iNJuI9sf7ufEUxTFWMCWpzlS810pgtj0mCP7qwvJA7k6pUbn2Larbi3yXl2j6vPznLNMz4arizKEY/2cihPIYQCvUB "PHP – Try It Online")
]