g | x | w | all
Bytes Lang Time Link
093AWK250314T212849Zxrs
247Go240815T144706Zbigyihsu
015Pyth240814T201012ZGlory2Uk
073Python 3.6 with IO220212T070451ZDeera Wi
020Charcoal220219T144142ZNeil
037Julia 1.0220215T144411ZMarcMush
047Julia 1.0220216T231713Zamelies
091Julia220213T210704ZDavid Sc
061Perl 5 nE220211T163845ZSundar R
010Vyxal220213T053145Zlyxal
064Perl 5 ap220211T111139ZKjetil S
033MATL220211T180304ZSundar R
037Vyxal220211T161250Zmath sca
068Python 2220211T095701Zovs
051Haskell220211T080613ZAZTECCO
00805AB1E220211T082426ZKevin Cr
092Python 3.8 prerelease220211T035825Zwasif
053JavaScript Node.js220210T142517Zl4m2
125C gcc220210T230908ZNoodle9
055Retina 0.8.2220210T200404ZNeil
029Burlesque220210T165500ZDeathInc
042R220210T163022ZDominic
007Brachylog220210T163654ZFatalize
012Husk220210T160152ZDominic

AWK, 93 bytes

{for(;(x=i++^2)<$1;)printf$1~"^"x&&(z=substr($1,length(x)+1))!~/^0/&&(m=sqrt(z))==int(m)?1:X}

Attempt This Online!

Will print a '1' for every match. No ones, no matches.

Go, 247 bytes

import(."fmt";."math")
func f(n int)bool{s,a,b:=Sprint(n),0.0,0.0
for i:=range s{c,d:=s[:i],s[i:]
if len(c)<1||len(d)<1||(len(d)>1&&d[0]<'1'){continue}
Sscan(c+" "+d,&a,&b)
A,B:=Sqrt(a),Sqrt(b)
if A==Round(A)&&B==Round(B){return 0<1}
}
return 1<0}

Attempt This Online!

Pyth, 15 bytes

}Qmjk^R2d*SsQUs

Try it online!

Test cases

A program that takes an integer value as a string (because the trailing 0 is recognized as a a separate value) and outputs True for the 'concats of two squares', False otherwise. The calculation time for the large values exceeds 1 minute.

Explanation:

}Q              # check if the input value is in the list.
  m             # The list is constructed by mapping:    
   jk           # concatenation
     ^R2        # and squaring
        d       # of the argument d
         *      # mapped over the cartesian product
          SsQ   # of the range from 1 to Q
             Us # with the range from 0 to Q-1

Python 3.6 (with IO), 73 bytes

n=input();l=range(int(n));print(n in[f"{i*i}{j*j}"for i in l for j in l])

You could also use,

n=input();l=range(int(n));print({n}&{f"{i*i}{j*j}"for i in l for j in l})

But unfortunately it doesnt output booleon values rather it outputs, {n} for True and set() for False

Try on Online

slightly longer answer (By 2 bytes)

n=int(input());print(str(n)in[f"{(k//n)**2}{(k%n)**2}"for k in range(n*n)])

and without a loop

n=int(input());m=k=0;exec('m+=f"{(k//n)**2}{(k%n)**2}"==str(n);k+=1;'*n**2);print(m>0)

Charcoal, 20 bytes

⊙…¹Iθ⊙…⁰Iθ⁼θ⪫X⟦ιλ⟧²ω

Try it online! Link is to verbose version of code. Takes input as a string and outputs a Charcoal boolean, i.e. - for a concatenation of two squares, nothing if not. Explanation:

 …                      Range from
  ¹                     Literal integer `1`
    θ                   To input
   I                    Cast to integer
⊙                       Does any satisfy
      …                 Range from
       ⁰                Literal integer `0`
         θ              To input
        I               Cast to integer
     ⊙                  Does any satisfy
           θ            Input as a string
          ⁼             Equals
              ⟦ιλ⟧      List of loop variables
             X          Vectorised to power
                  ²     Literal integer 2
            ⪫      ω    Joined

Julia 1.0, 47 44 37 bytes

~n="$(n^2)"
!a="$a"∈.~(r=0:a)'.*.~r

Try it online!

Julia 1.0, 38 47 bytes

~a=string.(a.^2);!a=any(~(0:a)'.*~(0:a).=="$a")

Try it online!

Based on MarcMush’s answer (tnx for pointing out the error when squaring)

Julia, 130 122 98 91 bytes

!x=√parse(Int,x)%1
f(a,s="$a",l=length(s))=0∈1:~-l.|>i->s[l-i]<'1'||!s[i+1:end]+!s[1:i]

Try it online!

Thanks to Sunda R we can save 8 bytes!

Thanks to MarcMush we can save 32 39 bytes!

Perl 5 -nE, 78 61 bytes

say int=~/^((.+)(?(?{$+eq(0|$+)&(0|sqrt$+)**2==$+})|^))(?1)$/

Try it online!

A whopping -17 bytes thanks to @kjs.

Explanation:

say int                      # convert input to number to remove leading 0s
        =~                   # and match it against the regex
           /^(               # match from the beginning of input
           (.+)              # match 1 or more digits
           (?                # evaluate a condition here
             (?{             # the condition is the result of this code
               $+            # the digits matched so far are in $+
               eq            # string equality check
               (0|$+)        # int($+) - golfy way of writing it
                             # if they're equal, no leading 0s here     
               & 
               (0|sqrt$+)    # again, golfy form of int(sqrt($+))
               **2==$+}      # square that and compare to original number
               )             # if no leading zeroes and number is a square
                             # do nothing and move on 
             |               # else
             ^               # add an impossible pattern here so regex match fails
             )
             )               
             (?1)            # now do the same match again, for the second square
             $               # and that should be the end of input
             /x;

The trick is in exploiting regex "backtracking" mechanism. Any time the part of the string we're looking at doesn't match the conditions we want, we make the match fail deliberately so that the regex engine chooses a different subset of the input string for the /(.+)/, and automatically tries the match again.

Vyxal, 10 bytes

›₌ɾʁẊ²vṅ⌊c

Try it Online!

An 05AB1E port.

Explained

›₌ɾʁẊ²vṅ⌊c
›          # Increment the input
 ₌ɾʁ       # The range [1, input + 1] and the range [0, input + 1)
    Ẋ      # Cartesian product of those ranges
     ²     # Square each number in each pair
      vṅ⌊  # Integer version of each pair concatenated into a single string
         c # Does that contain the original input? 

Perl 5 -ap, 69 64 bytes

$_=grep{1<grep/^0$|^[^0]/&sqrt!~/\./,unpack$_."A*","@F"+0}A1..A9

Try it online!

MATL, 33 bytes

Vf3L)"GV@:&),tUV=A3MtX^kU=*w]*?T.

Try it out

Outputs 1 for truthy, nothing for falsey.

V           % take in number (ignoring initial 0s) and convert to string
f           % get list of its indices (starting from 1)
3L)         % remove the last index
"           % for 1 to end-1
  GV        % get input as string again, say S
  @         % get the current loop index i
  :         % form range 1:i
  &)        % split S[1:i] and S[i+1:end]
  ,         % for each split part
    t       % duplicate it
    U       % convert to numeric
    V       % and back to string - this gets rid of initial 0s
    =A      % condition 1: did that give the same string back? 
    3M      % get the numeric form N of the current part again
    tX^kU   % floor(sqrt(N))^2
    =       % condition 2: did that get the number back
            %   i.e. is it a square number
    *       % AND those conditions
    w       % swap the other part in to be checked
  ]         % end
  *?        % if both parts satisfied the conditions
    T       % save True to output
    .       % break
            % (implicit) end
            % (implicit) end
            % (implicit) convert to string and display

Vyxal, 37 bytes

Probably can be golfed a lot, but this is too long for me. So basically for every i in input n, it checks if both n[:i] and n[i:] are squares.
I think the time complexity is \$O(2*\mathrm{len}(n)) \$

Lʁƛ?fnȯṅ:h⌊[⌊|3]∆²→?fẎṅ:h⌊[⌊|3]∆²←∧;a

Explanation:

Lʁƛ?fnȯṅ:h⌊[⌊|3]∆²→?fẎṅ:h⌊[⌊|3]∆²←∧;a
Lʁ                                     Exclusive 0 range of length(n)                                    
  ƛ                                    Map through range
   ?f                                  Push stringified n
     nȯṅ                               Slice from loop index to end
        :h⌊[⌊|3]                        Duplicate slice, if int(head) = 0, push 3 (non-square) else int(slice)
               ∆²→                     Set var to "is a perfect square?"
                  ?f                   Push stringified n
                    Ẏṅ                 Slice from 0 to loop index
                      h⌊[⌊|3]           Duplicate slice, if int(head) = 0, push 3 (non-square) else int(slice)
                            ∆²         Is it a perfect square?
                              ←        Get var
                               ∧       Are both are squares?
                                ;a     End map, check if any element is true.

Try it Online!

Python 2, 68 bytes

Inefficient and somewhat boring approach.

lambda n:`n`in('%d'*2%(a*a,b*b)for a in range(1,n)for b in range(n))

Try it online!


Python 2, 77 bytes

Much more efficient and interesting.

f=lambda n,m=0,d=1:n and((m*10<d!=10)==n**.5%1+m**.5%1)|f(n/10,m+n%10*d,d*10)

Try it online!

Haskell, 54 51 bytes

f n|l<-show.(^2)<$>[0..n]=elem(show n)$(++)<$>l<*>l

Try it online!

So much inefficient approach:
l is all numbers up to input squared and to string.
We search trough the powerset of l if there is a pair that form the input

05AB1E, 8 bytes

ÝāsânJIå

Based on my 05AB1E answer for the Sum of two squares challenge.

Try it online or verify (almost) all test cases (151296561 is omitted since it'll timeout).

Explanation:

Ý         # Push a list in the range [0, (implicit) input]
 ā        # Push a list in the range [1,length] (without popping the list)
  s       # Swap so the [0,input] list is at the top
   â      # Cartesian product: create all possible pairs using these two lists
    n     # Square each inner integer
     J    # Join each pair together
      Iå  # Check if the input is in this list
          # (after which the result is output implicitly)

We can't just use the range \$[0,input]\$ twice, since it would create a false positive with for example "09" and input 9. We also can't just use the range \$[1,input]\$ twice, since it would fail with for example input 90. Hence the use of the range \$[1,input+1]\$ with \$[0,input]\$ for the creation of pairs with the cartesian product instead.

Python 3.8 (pre-release), 92 bytes

f=lambda n,x=1:x<len(n)and all(e[0]!='0'and int(e)**.5%1==0for e in[n[:x],n[x:]])or f(n,x+1)

Try it online!

-28 for @ophact's tip

JavaScript (Node.js), 56 53 bytes

2 byte from tsh

x=>(g=_=>x--&&x*x+'|'+g(),x+g).match(`^(${g()}){2}_`)

Try it online!

RegEx with many choices

C (gcc), 127 125 bytes

i;r;q(n){for(r=i=n;i;--i)r=r&&i*i-n;i=!r;}t;h;m;f(n){for(t=h=0,m=1;n>9;n/=10,m*=10)n%10|m<2?h+=n%10*m,t|=q(n/10)*q(h):0;n=t;}

Try it online!

Saved 2 bytes thanks to ceilingcat!!!

Retina 0.8.2, 55 bytes

^0+

\B
$'¶$`;
A`;0.
\d+
$*
m`(^1|11\1)+;(1(?(2)1\2))*$

Try it online! Link includes faster test cases (a ^ after the m` would speed it up enough to be able to check 151296561 on TIO). Outputs the count of square concatenations, so for example 144100 can be split up as 144 and 100 or alternatively as 1 and 44100, so the output would be 2 in that case. Explanation:

^0+

Delete leading zeros.

\B
$'¶$`;

Try splitting between every pair of digits.

A`;0.

Delete numbers with leading zeros.

\d+
$*

Convert to unary.

m`(^1|11\1)+;(1(?(2)1\2))*$

Match two square numbers. (1(?(2)1\2))* is a generalised match for a square number; (^1|11\1)+ is a simplified special case for a non-zero square to be matched at the start (of a line).

Burlesque, 29 bytes

Jsuf{?sXXsm}0_+)up2CB)++jup~[

Try it online!

J   # Duplicate
su  # Substrings of
f{  # Filter for
 ?s # Sqrt
 XX # [floor, ceil]
 sm # Same (i.e. is int)
}   # -- Is square
0_+ # Append 0 to list
)up # Unparse each to str
2CB # Combinations of pairs
)++ # Mapped Concat 
j   # Reorder stack
up  # Unparse input
~[  # Is in list

R, 42 bytes

function(x)x%in%outer(y<-(0:x)^2,y,paste0)

Try it online!

Same horribly-inefficient approach as my Husk answer.

R's %in% function to search for an element in a vector conveniently appears to cast its arguments to the same type (here the numeric input x and the character vector of pasted-together squares), which was a nice surprise to me.

Note: After reading Fatalize's comment, I realise that this answer is also very close to pajonk's answer to the "Sum of two squares" challenge. Note though that that answer wasn't the shortest in R, so a small change to the challenge does seem to favour a completely different approach, which is also nice.

Brachylog, 7 bytes

~cĊ~^₂ᵐ

Try it online!

Explanation

~cĊ       Deconcatenate into a couple of 2 elements Ċ
  Ċ~^₂ᵐ   Each element of Ċ must be the square of a number

Husk, 12 bytes

€s¹Σ´Ṫ+mos□ŀ

Try it online!

Outputs nonzero for 'concats of two squares', zero for numbers that aren't.

Builds a list of 'concat of two squares' numbers, and then checks if the input is present. So not very efficient for large inputs...

€s¹Σ´Ṫ+
       mos    # get strings of 
          □ŀ  # all squares up to input,
    ´Ṫ        # combine all combinations
      +       # by concatenation,
   Σ          # flatten the list-of-lists
€s¹           # and look for the input as a string