Is it a pleasing number? A pleasing number (according to this definition) is a number that can be passed through the following process (let's use 41802000 as an example):


Separate the trailing identical numbers (41802000 =&gt; [41802, 000])
Sort the first half of the digits and take the maximum ([41802, 000] =&gt; [8, 000])
Take the length of the final element. Call the resultant elements A and B ([8, 000] =&gt; A=8, B=3)
Is NB = A for any integer N? (True in this example; 23 = 8)


If the input results in True from the following process, it is considered pleasing.

Your task is to take an integer x, and output whether x is a pleasing number. You can output any two distinct values for truthy and falsey, but please state what you're using in your answer. x is guaranteed to have at least two distinct digits (e.g. 111 is an invalid input). As with most challenges, you may take x as a string, or a list of digits.

This is a code-golf so shortest code in bytes wins.

Test cases

          Input          Output
       41802000               1
            100               1
      123456788               0
      451111111               0
234543454545444               0
             12               1
       41902000               0
          92599               1
APL (Dyalog), 36 bytes



{(⊢≡⌊)(⌈/⍎¨⍵/⍨~o)*÷≢⍵/⍨o←⌽⌊\1,2=/⌽⍵}


Try it online!

How?

Almost a poem.

⌽⍵ - reverse the input once,

1,2=/ - get the differences list.

⌊\ - keep only the first group of ones,

⌽ - and flip it over to complete.



o← - assign to o,

~o - switch ones and zero(s),

⍵/⍨ - filter the input with it,

⍎¨ - turn the result into list of each digit,


⌈/ - and get the maximum. (that's A)




⍵/⍨o - filter the input with o unalt(ered),

≢ - and take the length, that would be B.

÷ - get one divided by this result,

* - and take A to that power thee.



⊢≡⌊ - integer?