text:
Square-Random-Symmetrical
Challenge
Write a program or a function that returns or prints a square-random-symmetrical matrix.

Input
N: The size of the matrix i.e 6 x 6

Output
The matrix. You can either print it, return it as string (with the newlines) or as a list/array of lists/arrays.

Rules

You need to use at least N different characters, where N is the size of the square matrix (input). Since we 're using only letter [a, z][A, Z] and digits [0, 9] (and only 1 digit at the time) you can assume that N < 27 and N > 2, that is because at N <= 2 you can't have both letters and digits. Last but not least, every letter/digit must have non-zero probability of occurring (uniform distribution is not a necessity). However, the result must have at least N different letter/digits.
The matrix has to be both horizontally and vertically symmetrical.
Exactly 2 rows and 2 columns must contain strictly one single-digit number (it's position should be random as well). The rest of rows/cols will contain only letters. Consider letters as [a, z] and [A, Z] and of course single-digit numbers as [0, 9].
Just to be easier, you can assume that the case of the letters doesn't matter, as long as the cases are symmetrical which means: a=A, b=B, etc.
Every possible output must have a non-zero probability of occurring. The random distribution doesn't need to be uniform.

Example
Input: 8
Output:
c r p s s p r c
r k o z z o k r
u t 2 a a 2 t u
y n q z z q n y
y n q z z q n y
u t 2 a a 2 t u
r k o z z o k r
c r p s s p r c

Comments are not for extended discussion; this conversation has been moved to chat.

Charcoal, 30 bytes
ＮθＥ⊘⊕θ⭆⊘⊕θ‽βＪ‽⊘θ‽⊘θＩ‽χ‖ＯＯ→↓﹪θ²

Try it online! Link is to verbose version of code. If n is always even, then for 23 bytes:
ＮθＥ⊘θ⭆⊘θ‽βＪ‽⊘θ‽⊘θＩ‽χ‖Ｃ¬

Try it online! Link is to verbose version of code. Explanation:
Ｎθ

Input \$ n \$.
Ｅ⊘θ⭆⊘θ‽β

Create an \$ \frac n 2 \$ by \$ \frac n 2 \$ array of random lowercase letters. This prints implicitly as a square.
Ｊ‽⊘θ‽⊘θ

Jump to a random position in the square.
Ｉ‽χ

Print a random digit.
‖Ｃ¬

Reflect horizontally and vertically to complete the matrix.

R, 124 118 bytes
function(n,i=(n+1)/2,j=n%/%2,m="[<-"(matrix(-letters,i,i),j-1,j-1,0:9-1))cbind(y<-rbind(m,m[j:1,]),y[,j:1])
`-`=sample

Try it online!
In R, things that look like operators are just functions that get special treatment from the parser.
If you redefine an operator (like -) to be some other function, it keeps the special treatment from the parser. Since - is both prefix and infix, and I need to call the sample function with both one and two arguments, I can use
`-`=sample

to get what I want.
So the code -letters is translated to sample(letters), which randomly shuffles the letters built-in. But j-1 is translated to sample(j,1), which randomly samples 1 item from the vector 1:j.
(This behaviour of the sample function depending on the number of parameters and what the first parameter is, is a huge pain in the butt in production code, so I'm happy to find a great use of its perverse nature here!)
Otherwise the code just makes the top left quadrant of the required result, replaces a random element (the j-1,j-1 bit) with a random digit (the 0:9-1 bit), and folds it out for the required symmetry. The i and the j are needed to deal with the even and odd cases.

I wish I could +2 for the great explanation and also editing the related R golfing tip answer. You can save a few more bytes

What a fantastic solution and explanation!

Python3, 287 bytes
My first try at golfing something here; I'm sure someone can do far better:
import random as rn, math as m
n=int(input())
x,o=m.ceil(n/2),n%2
c=x-1-o
f=lambda l,n: l.extend((l[::-1], l[:-1][::-1])[o])
q=[rn.sample([chr(i) for i in range(97, 123)],x) for y in range(x)]
q[rn.randint(0,c)][rn.randint(0,c)] = rn.randint(0,9)
for r in q:
    f(r, n)
f(q, n)
print(q)

Try it Online!
Thanks to HyperNeurtrino, Ourous and Heiteria this shrunk down to 193 bytes (see comments). However, TFeld correctly pointed out that multiple calls to sample aren't guaranteeing at least N different characters.
That stuff in mind, try this new version that should guarantee at least N different characters per run.
Python3, 265 260 bytes, at least N distinct characters
from random import *
n=int(input())
x=-(-n//2)
o=n%2
c=x+~o
i=randint
u=[chr(j+97)for j in range(26)]
z,q=u[:],[]
for y in [1]*x:
  shuffle(z)
  q+=[z[:x]]
  z=z[x:] if len(z[x:])>=x else u[:]
q[i(0,c)][i(0,c)]=i(0,9)
for r in[q]+q:r.extend(r[~o::-1])
print(q)

Try it online!

Welcome to PPCG! You can golf a few of the whitespaces out; there's no need to put spaces between symbols and symbols and letters. a[:-1][::-1] is fundamentally equivalent to a[:-2::-1], and you can import random as r instead of rn, and you can move the for loop into an inline expression. Try It Online!

You can remove the math import by using -(-a // 2) instead of math.ceil(a / 2) which is basically negative floor-div of the negative (effectively ceiling). https://tio.run/##XY7LagMxDEX3/gpvChK1k2YKDRnwlxgv3Hk0Bo9sKy44Xz@Ns2npSroH6XLyvV4Tve972HLiKtnTnDbpb5IFmUAVAuXvCoiiqWQ0aDoeB1T0MojJNH3SSawm@u1z9jIqGuNhaXWhGSDacdQnp6LVw3NDmxyKYiwfbn7LcQE7XRnC6@WMa2IZZKAu8LXA8IFOtSe9/9KGTpTHd5fsam9qQvc/m7/5gqJ3cO8o4wqs6EGg9JG53xTc9x8

Very clever thought with the division, thank you! I edited your improvements into my post; I'm new here, so if the way I did that is incorrect I welcome any feedback. Thanks again!

You can get it down to 236: Try it online!

Even further, at 196: Try it online!

The multiple sample()s don't guarantee that you get at least N different characters. I managed to get [['g', 'x', 'x', 'g'], [7, 'x', 'x', 7], [7, 'x', 'x', 7], ['g', 'x', 'x', 'g']] for N=4, which only has 3 distinct chars

Hm, Good catch @TFeld - I'll need to think on that a bit

By using from random import*, you can save 3 bytes to reach (currently) 193: Try it online!

@TFeld Check it out, I've posted an improved version that should make sure we generate at least N distinct characters per run

@souldeux As Heiteira points out, you can remove the space between import and * on the first line to save another byte!

APL (Dyalog Classic), 45 44 43 40 bytes
thanks @Adám for -1 byte
26{(⎕a,⍺⍴⎕d)[⌈∘⊖⍨⌈∘⌽⍨⍺+@(?⊂⌊⍵÷2)?⍵⍴⍺]},⍨

Try it online!
uses ⌈ (max) of the matrix with its reflections to make it symmetric, so it's biased towards the latter part of the alphabet
the digit is chosen uniformly from 0...25 mod 10, so it has a small bias to lower values

⌊2⍴⍵÷2)?⍵ ⍵⍴26]} → ⌊⍺⍵÷2)?⍺⍵⍴26]}⍨

@Adám clever!

Yeah, I just realised.

If I'm not mistaken, you can change ⌊⍺⍵÷2 → ⍺⍵.

@Adám I can't - if N is odd, the digit might end up in the centre and there'd be only 1 row/column containing it

Ah, I didn't think of that. OP could need some test cases.

Japt, 31 bytes (Fixed digit position)
;
/2 c
VÆVÆBö}ÃgT0@Mq9Ã®êUvÃêUv

Try it online!

Japt, 41 bytes (Random digit position)
;
/2 c
VÆVÆBö}ÃgMq´VÉ ,MqVÉ @Mq9Ã®êUvÃêUv

Try it online!

Explanation
;                               Change to new vars
/2 c                            set implicit var V equal to implicit var U / 2 rounded up
VÆVÆBö}ÃgT0@Mq9Ã®êUvÃêUv        Main function

VÆ                              Range from 0 to V and map
  VÆ                            Range from 0 to V and map
    Bö}Ã                        return random char from alphabet
        gT0@                    map upper-left corner
            Mq9Ã                return random number
                ®êUv            horizontal mirror
                    êUv         vertical mirror

Your digits are currently always inserted at the same place. Based on the challenge, the position of the digits should be random as well (and may not be in the middle row and/or column for odd inputs due to rule 4).

@KevinCruijssen I dont see where the challenge say the number position must be random as well, I'll ask OP for clarification though

Ah, you're indeed right. I saw it's random in all other answer, so I might have falsely assumed it's mandatory. We'll see what OP says. I actually hope fixed it allowed, it would make it a lot easier to fix that problem for my prepared answer.. ;)

C (gcc), 198 197 196 bytes
Saved 2 bytes thanks to ceilingcat.
#define A(x)(x<n/2?x:n-1-x)
#define R rand()
S(n,x,y){int s[x=n*n];for(srand(s),y=R;x;)s[x]=97+(--x*31+y)%71%26;y=n/2;for(s[R%y+n*(R%y)]=48+R%10;x<n*n;++x%n||puts(""))putchar(s[A(x%n)+A(x/n)*n]);}

Try it online!
Explanation:
// Coordinate conversion for symmetry
#define A (x) (x < n / 2 ? x : n - 1 - x)
// Get a random and seed
#define R rand()

S (n, x, y)
{
   // the array to store matrix values (x is the array size)
   // Note that we do not need the whole array, only its first quarter
   int s[x = n * n];

   // iterate n*n-1 times until x is zero
   for (srand(s), y = R; x;)
       // and fill the array with pseudo-random sequence of letters
       s[x] = 97 + (--x * 31 + y) % 71 % 26;

   // this is the max. coordinate of the matrix element where a digit may occur
   y = n / 2;

   // drop a random digit there
   s[R % y + n * (R % y)] = 48 + R % 10;

   // Now we output the result. Note that x is zero here
   for (;
       x < n * n; // iterate n*n times
       ++x % n || puts ("") // on each step increase x and output newline if needed
       )
       // output the character from the array
       putchar (s[A (x % n) + A (x / n) * n]);
}

Python 2, 259 bytes
from random import*
n=input();c=choice;r=range
w,W=n/2,-~n/2
o=n%2
A=map(chr,r(97,123))
l=[c(r(10))]+sample(A,n)+[c(A)for _ in' '*w*w]
l,e=l[:w*w],l[w*w:W*W]
shuffle(l)
l=[l[w*i:w*-~i]+e[i:i+1]for i in range(w)]+[e[-W:]]
for r in l+l[~o::-1]:print r+r[~o::-1]

Try it online!

Is using ints directly allowed? Cool idea on the ~ by the way. I was thinking of that too, but I'm not yet really used to it.

05AB1E, 29 40 38 bytes
A.rs;ò©n∍9ÝΩ®DnαLʒ®%Ā}<Ωǝ®ô»¹Éi.º.∊ëº∊

+11 bytes to fix the digit being at a random position while still keeping rule 3 in mind for odd inputs..
-2 bytes thanks to @MagicOctopusUrn, changing îï to ò and changing the position of the ».
Try it online of verify some more test cases.
Old (29 27 bytes) answer where the digit positions where always in the corners:
A.rs;ò©n∍¦9ÝΩì®ô»¹Éi.º.∊ëº∊

Try it online or verify some more test cases.
Explanation:
A           # Take the lowercase alphabet
 .r         # Randomly shuffle it
            #  i.e. "abcdefghijklmnopqrstuvwxyz" → "uovqxrcijfgyzlbpmhatnkwsed"
s           # Swap so the (implicit) input is at the top of the stack
 ;          # Halve the input
            #  i.e. 7 → 3.5
  ò         # Bankers rounding to the nearest integer
            #  i.e. 3.5 → 4
   ©        # And save this number in the register
    n       # Take its square
            #  i.e. 4 → 16
     ∍      # Shorten the shuffled alphabet to that length
            #  i.e. "uovqxrcijfgyzlbpmhatnkwsed" and 16 → "uovqxrcijfgyzlbp"
9ÝΩ         # Take a random digit in the range [0,9]
            #  i.e. 3
   ®Dnα     # Take the difference between the saved number and its square:
            #  i.e. 4 and 16 → 12
       L    # Create a list in the range [1,n]
            #  i.e. 12 → [1,2,3,4,5,6,7,8,9,10,11,12]
ʒ   }       # Filter this list by:
 ®%Ā        #  Remove any number that's divisible by the number we've saved
            #   i.e. [1,2,3,4,5,6,7,8,9,10,11,12] and 4 → [1,2,3,5,6,7,9,10,11]
     <      # Decrease each by 1 (to make it 0-indexed)
            #  i.e. [1,2,3,5,6,7,9,10,11] → [0,1,2,3,5,6,7,9,10]
      Ω     # Take a random item from this list
            #  i.e. [0,1,2,3,5,6,7,9,10] → 6
       ǝ    # Replace the character at this (0-indexed) position with the digit
            #  i.e. "uovqxrcijfgyzlbp" and 3 and 6 → "uovqxr3ijfgyzlbp"
®ô          # Split the string into parts of length equal to the number we've saved
            #  i.e. "uovqxr3ijfgyzlbp" and 4 → ["uovq","xr3i","jfgy","zlbp"]
  »         # Join them by new-lines (this is done implicitly in the legacy version)
            #  i.e. ["uovq","xr3i","jfgy","zlbp"] → "uovq\nxr3i\njfgy\nzlbp"
   ¹Éi      # If the input is odd:
            #  i.e. 7 → 1 (truthy)
      .º    # Intersect mirror the individual items
            #  i.e. "uovq\nxr3i\njfgy\nzlbp"
            #   → "uovqvou\nxr3i3rx\njfgygfj\nzlbpblz"
        .∊  # And intersect vertically mirror the whole thing
            #  i.e. "uovqvou\nxr3i3rx\njfgygfj\nzlbpblz"
            #   → "uovqvou\nxr3i3rx\njfgygfj\nzlbpblz\njfgygfj\nxr3i3rx\nuovqvou"
  ë         # Else (input was even):
   º∊       #  Do the same, but with non-intersecting mirrors

You could also save 2 bytes with the legacy version since it doesn't require »

@Emigna Verified with OP, and the position should indeed be random as well. Fixed for +11 bytes due to rule 3 with odd inputs.. >.> And 3 bytes could have been saved in the legacy because the ï was done implicitely as well. Unfortunately this doesn't apply to the 40-byte version because ∊ would insert instead of replace.

@MagicOctopusUrn The TIO you linked still contained my 29 bytes answer instead of 28, do you have the correct link? As for the failing for 2, the input is guaranteed to be 3 <= N <= 26.

@KevinCruijssen you're right, I'm a moron, here's the one I was working out: Try it online!

@MagicOctopusUrn Oh, didn't knew about that bankers rounding. That saves a byte in my current answer as well! :D And first appending a random digit and only then shuffling is a pretty smart approach as well. Not sure if it's 100% valid though, since you will always have the first n letters of the alphabet, instead of n random letters of the alphabet. And first joining by newlines and only then doing the mirrors saves a byte as well in mine. Thanks for -2 bytes! :) PS: One byte can be saved in your 28-byter by removing the trailing }. :)

Python 3, 197 bytes
As mentioned by @Emigna, doesn't work for odd values of N (I didn't understand the question properly)
from random import*
def m(N):M=N//2;E=reversed;R=range;B=[randint(48,57),*(sample(R(97,123),N)*N)][:M*M];shuffle(B);r=R(M);m=[k+[*E(k)]for k in[[chr(B.pop())for i in r]for j in r]];m+=E(m);return m

Try it online!
I do think the calls to randint() + sample() + shuffle() are too much, and getting rid of in-place shuffling would be great :)
I'm pretty sure this part (that selects the letters & digit) could be golfed a bit more.

Doesn't seem correct for odd N.

Damn, I had just assumed N would always be even since I don't get how the matrix could be symmetrical if it's odd !

These are some examples of odd symmetrical matrices.

Okay, thanks, I hadn't seen it that way ! Well I guess my answer is worthless as is then.

Python 2/Python 3, 227 bytes
from random import*
def m(N):n=N-N//2;r=range;C=choice;c=n*[chr(i+97)for i in r(26)];shuffle(c);c[C([i for i in r(n*(N-n))if(i+1)%n+1-N%2])]=`C(r(10))`;R=[c[i*n:i*n+n]+c[i*n:i*n+n-N%2][::-1]for i in r(n)];return R+R[::-1][N%2:]

ungolfing a bit:
from random import * # get 'choice' and 'shuffle'
def matrix(N):
    n = ceil(N/2) # get the size of the base block
    # get a shuffleable lowercase alphabet
    c = [chr(i+97)for i in range(26)]
    c = n*c # make it large enough to fill the base-block
    shuffle(c) # randomize it
    digit = choice('1234567890') # get random digit string
    ## this is only needed as to prevent uneven side-length matrices
    #  from having centerline digits.
    allowed_indices = [i for i in range( # get all allowed indices
        n*(N-n)) # skip those, that are in an unmirrored center-line
        if(i+1)%n  # only use those that are not in the center column
                 +1-N%2] # exept if there is no center column
    index = choice(allowed_indices) # get random index
    c[index]=digit # replace one field at random with a random digit
    ##
    R=[]
    for i in range(n):
        r = c[i*n:i*n+n] # chop to chunks sized fit for the base block
        R.append(r+r[::-1][N%2:]) # mirror skipping the center line
    return R+R[::-1][N%2:] # mirror skipping the center line and return

Older, almost correct versions below:
Python2, Python3, 161 bytes
from random import *
N=26
n=N-N//2
c=[chr(i+97)for i in range(26)]
R=[ r+r[::-1][N%2:]for r in[(shuffle(c),c[:n])[1]for i in range(n)]]
R+=R[::-1][N%2:]
print(R)

It seems N differing elements is only almost guarranteed.
Python 2/Python 3, 170 bytes
from random import*
def m(N):n=N-N//2;r=range;c=n*[chr(i+97)for i in r(26)][:n*n];shuffle(c);R=[_+_[::-1][N%2:]for _ in[c[i*n:i*n+n]for i in r(n)]];return R+R[::-1][N%2:]

It seems I forgot rule 3. Also somehow the [:n*n] slipped in.

Your answer is very clever in the way it constructs the symmetric matrix, but you have not satisfied rule 3 (as you don't have any digits in your result), nor rule 5 (e.g., if n = 3, you will never have an output containing a 'z', so not every output is possible).

Well pickle me and ... you're correct @ChasBrown ! Well, the [:n*n] is a remainder from a different approach and frankly it shouldn't be there. But you're correct about rule three. I'll have to correct it. Give me a bit.

Tried your solution here, but there was an index error... BTW, TryItOnline is super handy here at PPCG! (Also, this problem is way trickier than I thought at first...)

I litterally ran it over 10000 times without any error.

found it. a ':' was missing. I copied it directly from my script, but it must have gotten lost. it should be "... :-1][N%2:]for i ..." instead of "... :-1][N%2]for i ...".

@ChasBrown It is tricky because of the single digit that has to be in precisely two rows and two columns. Otherwise it'd be easy. Thanks for the tip with TIO. I'll keep that in mind.

Clean, 346 312 bytes
will golf more tomorrow
import StdEnv,Data.List,Math.Random,System.Time,System._Unsafe
$n#q=twice(transpose o\q=zipWith((++)o reverse o drop(n-n/2*2))q q)[[(['a'..'z']++['0'..'9'])!!(c rem 36)\\c<-genRandInt(toInt(accUnsafe(time)))]%(i*n/2,i*n/2+(n-1)/2)\\i<-[1..(n+1)/2]]
|length(nub(flatten q))>=n&&sum[1\\c<-q|any isDigit c]==2=q= $n

Try it online!

JavaScript (ES6), 213 209 206 bytes
n=>(a=[],F=(x=y=d=c=0,R=k=>Math.random()*k|0,g=y=>(r=a[y]=a[y]||[])[x]=r[n+~x]=v.toString(36))=>y<n/2?F(g(y,R[v=R(m=~-n/2)<!d&x<m&y<m?R(d=10):R(26)+10]=R[v]||++c,g(n+~y))&&++x<n/2?x:+!++y,R):!d|c<n?F():a)()

Try it online!
Commented
n => (                             // n = input
  a = [],                          // a[][] = output matrix
  F = (                            // F = main recursive function taking:
    x = y =                        //   (x, y) = current coordinates
    d = c = 0,                     //   d = digit flag; c = distinct character counter
    R = k =>                       //   R() = helper function to get a random value in [0,k[
      Math.random() * k | 0,       //         also used to store characters
    g = y =>                       //   g() = helper function to update the matrix
      (r = a[y] = a[y] || [])[x]   //         with horizontal symmetry
      = r[n + ~x] = v.toString(36) //         using the base-36 representation of v
  ) =>                             //
    y < n / 2 ?                    // if we haven't reached the middle row(s) of the matrix:
      F(                           //   do a recursive call to F():
        g(                         //     invoke g() ...
          y,                       //       ... on the current row
          R[v =                    //       compute v = next value to be inserted
            R(m = ~-n/2) < !d &    //       we may insert a digit if no digit has been
            x < m &                //       inserted so far and the current coordinates are
            y < m ?                //       compatible: 2 distinct rows / 2 distinct columns
              R(d = 10)            //         if so, pick v in [0, 9] and update d
            :                      //       else:
              R(26) + 10           //         pick v in [10, 35] for a letter
          ] = R[v] || ++c,         //       set this character as used; update c accordingly
          g(n + ~y)                //       invoke g() on the mirror row
        ) &&                       //     end of outer call to g()
        ++x < n / 2 ?              //     if we haven't reached the middle column(s):
          x                        //       use x + 1
        :                          //     else
          +!++y,                   //       increment y and reset x to 0
        R                          //     explicitly pass R, as it is used for storage
      )                            //   end of recursive call to F()
    :                              // else:
      !d | c < n ? F() : a         //   either return the matrix or try again if it's invalid
)()                                // initial call to F()

Python 2, 275 266 bytes
from random import*
def f(n):
 R=range;C=choice;A=map(chr,R(97,123));b=N=n-n/2;c=`C(R(10))`;s=[c]+sample(A,n-1)+[C(A)for i in R(N*N-n)]
 while b:shuffle(s);i=s.index(c);b=n%2>(i<N*N-N>N-1>i%N)
 a=[r+r[~(n%2)::-1]for r in[s[i::N]for i in R(N)]];return a+a[~(n%2)::-1]

Try it online!
Returns the array as a list of lists of characters. To satisfy Rule 1, we set up a pool of characters:
s = [c]                        # the unique digit...
     + sample(A,n-1)           # then sample without replacement `n-1` chars in a-z,
                               # so we have `n` distinct chars
     + [C(A)for i in R(N*N-n)] # and fill out the rest with any in a-z

The next tricky bit is rule 3: there must be exactly 2 columns and rows having a digit; this means for n odd, that the chosen digit may not appear in the middle column or middle row. Since we construct the array using a twice reflected square sub array s, that is accomplished here by using:
while b:            # to save a couple bytes, `b` is initialized
                    # to `N`, which is greater than 0.
    shuffle(s)      # shuffle at least once...
    i = s.index(c)  # c is the unique digit used
    b = n%2
             >      # if n is even, 0>(any boolean) will be false,
                    # so exit the loop; otherwise n odd, and we are
                    # evaluating '1 > some boolean', which is equivalent
                    # to 'not (some boolean)'
         (i<N*N-N   # i is not the last column of s...
             >      # shortcut for ' and ', since N*N-N is always > N-1
          N-1>i%N)  # is not the last row of s

i.e., shuffle at least once; and then, if n is odd, keep looping if the digit is in the last column or the last row of s.

Pyth, 48 bytes
L+b_<b/Q2JmO/Q2 2jy.eyXWqhJkbeJOT<csm.SGQK.EcQ2K

Try it out online here.
The program is in 3 parts - definition of palindromisation function, choosing location of numeric, and main function.
Implicit: Q=eval(input()), T=10, G=lower case alphabet

L+b_<b/Q2   Palindromisation function
L           Define a function, y(b)
      /Q2   Half input number, rounding down
    <b      Take that many elements from the start of the sequence
   _        Reverse them
 +b         Prepend the unaltered sequence

JmO/Q2 2   Choose numeric location
  O/Q2     Choose a random number between 0 and half input number
 m     2   Do the above twice, wrap in array
J          Assign to variable J

jy.eyXWqhJkbeJOT<csm.SGQK.EcQ2K   Main function
                           cQ2    Divide input number by 2
                         .E       Round up
                        K         Assign the above to K
                    .SG           Shuffle the alphabet
                  sm   Q          Do the above Q times, concatenate
                 c      K         Chop the above into segments of length K
                <             K   Take the first K of the above
  .e                              Map (element, index) as (b,k) using:
       qhJk                         Does k equal first element of J?
      W                             If so...
     X     b                          Replace in b...
            eJ                        ...at position <last element of J>...
              OT                      ...a random int less than 10
                                    Otherwise, b without replacement
    y                               Apply palindromisation to the result of the above
 y                                Palindromise the set of lines
j                                 Join on newlines, implicit print

Using several shuffled alphabets should ensure that the number of unique characters is always more then the input number.


text:
Compare version numbers
When we publish some software, we assign a version number to it. And users may want to update to the latest version of some software. So, it is the time to find out which version should be newer.
Input
Input two version numbers as strings.
In the context of this challenge, we only support version numbers which are some digits joined by dots.

A version number is a non-empty string which may only contain digits (0 ~ 9) and dots (.).
Dots would not be the first / last character of a version number.
There must be some digits between dots. No two dots may appear continuously.
All numbers in a version number would be less than 216.

Output
Compare the inputted version numbers and output whether first one is greater than / equals to / less than the second one. You are allowed to choose one of the following presentations:

Use positive number / zero / negative number, while zero means equal;
Use three constant distinct values;

Comparing
You are not required to implement the algorithm described in this section. Your submission is valid as long as it result the same output with this algorithm.

Version numbers are some decimal numbers joined by dots. We first split the two version numbers to arrays of numbers;
Padding the ending of arrays with zeros to make them have same length;
Compare from the first item to the last one:

If the two array items different, the greater number means greater version number
If they are the same, continue to compare the following items;
If all items in the array are equal, the two versions are equal.

Testcases
version1  version2  result
2         1         >
1.0.0     1         =
1.0       1.0.0     =
1.2.42    1.2.41    >
1.1.56789 1.2.0     <
1.10      1.2       >
1.20      1.150     <
18.04     18.4      =
7.010     7.8       >
1.0.0.1.0 1.00.00.2 <
00.00.01  0.0.0.1   >
0.0.1     0.1       <
42.0      4.2.0     >
999.999   999.999.1 <
2018.08.1 2018.08   >

Related, related

.NET has a Version object, but a single character isn't supported in it :(

@BrianJ and appending '.0' costs to many characters? :)

Well, it actually expects 2, 3, or 4 portions. So it fails on the 1.0.0.1.0 test case (though I did try your idea initially :) )

I think Windows has a built-in that'll do this: StrCmpLogicalW

I wanted to use php's version_compare, but it returns the wrong results for any test cases where the versions differ by trailing zeroes

What is the maximum number of dots one can expect in a version number?

@jayce I’m not limiting this, so it may be any length while your submission should work in theory (it is fine to fail due to some limitations from hardware or language if the length is reasonable large)

Can we take input as an array of numbers without dots (e.g. "1.0.0" -> [1, 0, 0])?

@cairdcoinheringaahing I don't think it may be acceptable. Since no one may write version numbers like [1, 0, 0]. Parsing version number should be a part of this challenge.

Python 2, 84 79 76 bytes
lambda*l:cmp(*map(lambda v:map(int,v.split('.')+[0]*len(`l`))[:len(`l`)],l))

Try it online!
Outputs -1,0,1 for <,=,>

05AB1E (legacy), 15 14 13 bytes
'.¡0ζε`.S}0K¬

Outputs -1  []  1 for <  =  > respectively.
-1 byte thanks to @Emigna.
Try it online or verify all test cases.
Explanation:
'.¡              # Split on dots
                 #  i.e. ['1.0.1.1.0','1.00.2.0']
                 #   → [['1','0','1','1','0'],['1','00','2','0']]
   0ζ            # Zip, swapping rows and columns, using '0' as filler
                 #  i.e. [['1','0','1','1','0'],['1','00','2','0']]
                 #   → [['1','1'],['0','00'],['1','2'],['1','0'],['0','0']]
     ε   }       # Map each:
      `          #  Push both values to the stack
       .S        #  And calculate the signum (1 if a>b; -1 if a<b; 0 if a==b)
                 #   i.e. [['1','1'],['0','00'],['1','2'],['1','0'],['0','0']]
                 #    → [0,0,-1,1,0]
          0K     # Remove all zeros
                 #  i.e. [0,0,-1,1,0] → [-1,1]
            ¬    # Then take the head as result
                 #  i.e. [-1,1] → -1

You can use 0K instead of ʒĀ}.

@Emigna Ah of course.. Thanks.

R, 32 bytes
rank(numeric_version(scan(,"")))

Try it online!
Using an R builtin
Outputs 1 2, 1.5 1.5, 2 1 for less, equal, greater.

Best so far, without builtin :
R, 151 142 125 107 bytes
function(v,L=strsplit(v,'\\.'))Find(c,sign(Reduce('-',Map(as.double,Map(c,L,Map(rep,0,rev(lengths(L))))))))

Try it online!
Unrolled code with explanation :
function(v){             # character vector of 2 elements as function arg;
  L=strsplit(v,'\\.')    # obtain a list of two character vectors
                         # with the separated version numbers;
  R=rev(lengths(L))      # store in vector R the lengths of the 2 vectors and reverse it;
  M1=Map(rep,0,R)        # create a list of 2 vector containing zeros
                         # repeated R[1] and R[2] times;
  M2=Map(c,L,M1)         # append to the vectors in list L the zeros in M1;
  M3=Map(as.double,M2)   # convert the character vectors in M2 to double;
  w=sign(Reduce('-',M3)  # compute the sign of element by element difference M[[1]] - M[[2]]);
  Find(c,w)            # returns the first non zero element in w, if none return NULL;
}
# N.B. as.double is necessary because "0XX" is interpreted as octal by strtoi unless
#      we use strtoi(x,10) which is exactly the same length of as.double(x)

Outputs -1, NULL, 1 for less, equal, greater.

Original concept, golfed down using sapply, [<- and %*%:
R, 129 bytes
function(x,y=strsplit(x,"\\."),w=sign(sapply(y,function(x)strtoi("[<-"(rep(0,max(lengths(y))),seq(x),x),10))%*%c(1,-1)))w[!!w][1]

Try it online!
Now you have a list of two equal-length vectors of integers. Calculate the pairwise differences using Reduce and output the first non-zero element using the tricky little w[!!w][1] form at the end.
Outputs -1, NA, 1 for less, equal, greater.

Impressive! Quick golf: extra newline at the end of your code - it should be 150 bytes ;)

reduce the number of named variables.... I feel there is a way to do it using a matrix instead of lists but I haven't found how to do it yet.

@JayCe the problem is the usual ways to make a list into a matrix recycles rather than fills with NA, so then you're stuck with counting the number of . in advance.

You can get this down to 100 bytes using scan function(a,b,d=scan(t=a,se='.'),e=scan(t=b,se='.'),f=1:max(lengths(list(d,e))),g=d[f]-e[f])g[!!g][1] (or 106 if you want to return -1,NA,1 not (negative),NA,(positive).

@mnel that is a clever use of scan !

@ngm: w[!!w][1] is great ! I got 125 but with the use of scan is better !

@mnel the 100 byte solution needs a little work. It fails on the last two test cases. The padding has to be 0 and not (implictly) NA. I've made the answer a Community Wiki so whoever can fix it up can just add it.

@ngm @mnel @digemall I have golfed your original approach to 129 bytes :) I have asked in a comment to the OP whether we can assume an upper bound to the number of dots - that we could use in place of max(lengths(y)).

assuming for instance it,s capped at 4^9 we get to 117 chars

@JayCe: 111 bytes with no assumptions (question updated), but if that assumption is valid, maybe we can save something more :)

@digEmAll still waiting for an asnwer from OP.... assuming the max number of dots in 8 (9 integers separated by 8 dots) the best I can achieve by tweaking your code is 110

@digEmAll golfed 4 bytes by first calculating the sign , and then do Find(c,x). I think that's a new trick.

@JayCe: indeed, great trick !

@JayCe: find several builtin... compareVersion unfortunately doesn't work as requested in case of different lengths (e.g. 1.0.0 vs 1.0), but numeric_version does :)

Let us continue this discussion in chat.

Perl 6, 63 47 22 bytes
{"v$^a cmp v$^b".EVAL}

Try it online!
Turns out that Perl 6 has a version type that pretty much fits the description. This is an anonymous code block that takes a list of two version strings and returns either More,Same or Less.
Explanation:
{                    }  # Anonymous code block
 "             "        # Create a string of code
  v$^a cmp v$^b         # Comparing the two versions
                .EVAL   # And EVAL it

Or, without built-in types for 47 bytes:
{first +*,[Z<=>] map *.split('.')[^@_.ords],@_}

Try it online!
Anonymous code block that takes two strings and returns More if the second is greater, Less if the second is smaller and Nil if they are equal.
Explanation:
{                                             } # Anonymous code block
                 map *.split('.')          ,@_  # Split both strings by '.'
                                 [^@_.ords]     # Pad the lists by a lot
          [Z<=>]   # Zip the strings with the <=> operator
 first +*,  # Get the first value that when coerced to an int, is not 0

APL (Dyalog Unicode), 18 17 bytes
1 byte saved thanks to @Adám for using ⍤1 instead of ∘↑(...)¨ and by changing the input format from a nested array to a matrix
(⍋-⍒)(⍎¨∊∘⎕D⊆⊢)⍤1

Try it online!
Takes the input as a matrix of chars as the right argument, where each version string is on its own row. Outputs ¯1 1, 0 0, 1 ¯1 for <, =, > respectively.
(⍎¨∊∘⎕D⊆⊢)⍤1 on each row

∊∘⎕D⊆⊢ group all occurrences of digits, that is, split on .
⍎¨ and convert each of these occurrences to a number

↑ convert to a matrix, where the first input is on the top row and the second one in the bottom, padding with 0s where necessary
(⍋-⍒) and

- subtract

⍒ the indices into the rows which would sort them in descending order
⍋ same as the top but for ascending order

Java (JDK 10), 201 96 89 bytes
java.util.Comparator.comparing(java.lang.module.ModuleDescriptor.Version::parse)::compare

Try it online!
Returns a negative number if the first version is smaller than the second one, a positive one if the first version is greater than the second one and 0 if they're equal.
Yep, that's some heavy work to "just" call a built-in!
Credits

-14 bytes, thanks to Kevin Cruijssen

I'm rather surprised by the length of this answer. Any golf is appreciated!

Can i<x&i<y&t==0 become i<x&i<y&t<1?

@Cowsquack No, because t can hold any of -1, 0 or 1.

I tried, but I'm only able to remove three bytes.. 228 bytes

Thank @KevinCruijssen . I thought about doing this during lunch time, but hadn't any time to implement it yet. :) Also, it's 4 bytes, not 3 (we usually don't count the ; after a lambda). ;-)

Found something more: 217 bytes

That's probably it.. Already tried try-finally so the if-check can be simplified; tried return inside the loop if t!=0; tried using Integer and i.compare(i.valueOf(...),i.valueOf(...)); tried using generics like this <T>T[]g(T s){return(T[])(s+"").replaceAll("(\\.0+)*$","").split("\\.");}; etc. All are 2-6 bytes longer. If you (or anyone else) does find something more, let me know please. Curious to know what. :)

@KevinCruijssen I could save a few bytes by getting rid of the transformation to a constant. So that any negative value means right is greater and any positive values means left is greater.

@OlivierGrégoire Ah nice. In that case you can use Integer and i.valueOf to save 2 more bytes: 201 bytes. NOTE (mainly for others reading): .decode instead of .valueOf doesn't work due to potential leading zeroes, which are interpret as octal numbers when using .decode.

@KevinCruijssen While you posted your comment I was doing a similar thing by using new Integer instead, for the same amount of bytes.

@OlivierGrégoire Ah nice. In that case they can be new Short instead. I think it's save to assume version numbers will never be beyond 32000 in any regular versioning.. ;)

@KevinCruijssen No, I can't because "All numbers in a version number would be less than 2^16." Short ranges from -(2^15) to 2^15-1.

@ceilingcat then the comparison between 0.0.1 and 0.1 (in that order) would return 0.0.1 > 0.1 and fail.

@KevinCruijssen I could remove 105 bytes! How? Well, I found a built-in ;)

@OlivierGrégoire Rofl, nice one :D Didn't knew there was a builtin for that in Java without external libraries.

@KevinCruijssen Actually, I'm playing currently playing with modules for a side-project. That's how I found it. I would never have found it in other circumstances ;)

Brachylog, 49 40 bytes
+0|{~c[H,".",T]hị;T|ị;0|0}ᵐz{h-0&t↰₀|h-}

...It's still rather unimpressively lengthy.
Expects a list of two strings. Uses positive number / zero / negative number
as > / = / <.
Try it online!
Explanation
Splitting the inputs
Given an input that does not unify with [0, 0], such as ["1.02.0", "1.2.0.1.0"], the below segment outputs, e.g., [[1, "02.0"], [1, "2.0.1.0"]].
                            # unify the input with...
+0                          # : a list whose sum = 0 (output is 0)
  |{                     }ᵐ # : OR a list that when mapped...
    ~c                      # : : if the input string unifies with a list of the form...
      [H,".",T]             # : : : e.g. "1.02.0", H = "1", T = "02.0"
               hị           # : : : coerce the head to an integer
                 ;T         # : : : append the string T
                            # : : : "1.02.0" -> [1, "02.0"]
                   |ị       # : : OR it unifies with an integer
                     ;0     # : : : append 0
                            # : : : "1" -> [1, 0]
                       |0   # : : OR it unifies with 0
                            # : : : 0 -> [0]

Comparing the inputs
Given, e.g., [[1, "02.0"], [1, "2.0.1.0"]], zips the sublists into [[1, 1], ["02.0", "2.0.1.0"]] and compares the values in the head ([1,1]). Recur on the second sublist. Note that the zip predicate z cycles through shorter lists so that zipping with [0,0] is equivalent to zipping with [0], hence the previous step unifies 0 with 0 without further values appended.
z             # zip the sublists
 {          } # unify the result (r) with...
  h           # : take the head of the result
   -          # : : subtract the second value from the first
    0         # : : if the difference unifies with 0...
     &t↰₀     # : : recur on the tail of r
         |h-  # : OR unify with the difference of the elements of the head
              # : (equivalent to returning early)

JavaScript (ES6), 73 68 bytes
Saved 5 bytes thanks to @redundancy
Takes input as (a)(b). Returns \$0\$ for equal, a positive integer for greater than or a negative integer for less than.
a=>b=>(a+[...b].fill`.`).split`.`.some((x,i)=>d=~b.split`.`[i]-~x)*d

Try it online!

Nice. If I've understood correctly, you can save bytes by substituting replace with fill. The operands for - are swapped since both must now be coerced to a number. Try it online!

@redundancy Good idea! (Not sure if my implementation exactly is what you had in mind, though.)

I assumed your intent was to append enough values coercible to 0 such that mapping over the substrings of a eventually cycles through those 0 values if b contains more number segments than a. It so happens that the shortest method of ensuring that is so is to split over a b-length string of '.' by leveraging the existing split applied to a.

Python 2, 87 bytes
lambda*p:cmp(*zip(*map(lambda x,y:(x or 0,y or 0),*[map(int,u.split('.'))for u in p])))

Try it online!
Outputs -1,0,1 for <,=,>, respectively.

Retina 0.8.2, 54 bytes
\d+
$*
+`^(.)(.*=)\1
$2
(.*=|^=.*)1.*
<
.*1.*=.*
>
\.

Try it online! Link includes test cases. Uses the separator value as the equality output, so for convenience the header converts the input separator to = but it could be anything not in [.\d]. Explanation:
\d+
$*

Convert to unary.
+`^(.)(.*=)\1
$2

Repeatedly delete the first character from each side until they differ or one side runs out. This is much faster than trying to match prefixes, although possibly not golfier. At this point, the strings are in one of several forms, which need to be decoded to a comparison result.

If neither string contains a 1 then the result is =
If the left string starts with a 1 then the result is >
If the right string starts with a 1 then the result is <
If the left string is empty then the result is <
At this point the right string is empty so the result is >

Another way of thinking about this is that if one string contains a 1 and the other does not start with a 1 then that string is greater, however that turns out to be a byte longer.
(.*=|^=.*)1.*
<

Check for case 3, or case 4 without case 1.
.*1.*=.*
>

If the left string still contains a 1 at this point then it is greater.
\.

Otherwise delete any left over .s.
Firefox Browser Console REPL, 19 bytes
Services.vc.compare

I believe this internal function performs the required comparison. It returns -1, 0, or 1.

I would suggest you post the Firefox chrome code as another answer...

btw, I'm not sure how Firefox chrome code count its bytes. Should Cu.import("resource://gre/modules/Services.jsm"); be counted?

@tsh That's why I added "Browser Console REPL"...

C (gcc),  140  134 bytes
This code outputs a negative, 0 or a positive for <,= or > respectively.
i;n;p;q;g(char*s){for(i=n=0;*s&&++n&&*s-46;i=i*10+*s++-48);i=i;}f(char*a,char*b){for(p=q=0;*a+*b&&p==q;b+=n)p=g(a),a+=n,q=g(b);a=p-q;}

Try it online!
Edits:

Saved 6 bytes thanks to ceilingcat !

The challenge states: "Use three constant distinct values;" Your code doesn't return constants.

@Olivier It states I can "Use three constant distinct values;" OR "Use positive number / zero / negative number, while zero means equal;"

My bad! You're correct.

Ruby, 75 bytes
->a,b{c=d=0;c,d=[a,b].map{|f|f.slice!(/\d*./).to_i}while''<a+b&&c==d;c<=>d}

Try it online!

Japt, 16 11 bytes
-5 bytes from @Shaggy
Outputs:

negative number for <
(null or 0) for =
positive number for >

N®q.Ãy_r-Ãf

Try it online!

Would this work?

@Shaggy Yep, It could be shorten to 10 bytes outputing negative, null or 0, positive for < = > respectively but I dont know if the input can be taken as an array

JavaScript (Node.js), 105 88 80 bytes
-17 bytes from @redundancy. Wow!
-8 bytes removing Math.sign. Thanks @tsh
Returns a negative, zero or positive value
f=(a,b,r=/(\d*).?(.*)/)=>a+b&&+((a=r.exec(a))[1]-(b=r.exec(b))[1]||f(a[2],b[2]))

Try it online!

88 bytes using exec to split strings. Try it online!

@redundancy Damn, thanks! thats a pretty cool trick

Maybe you want to remove the Math.sign to save some bytes by switching to positive / zero / negative values. And maybe a positive sign is required.

Clean, 116 111 bytes
import StdEnv,Text
?s=map toInt(split"."s)
$a b= @(?a)(?b)
@[h:t][u:v]|h==u= @t v=h-u
@l[]=sum l
@[]l= ~(sum l)

Try it online!
Outputs a negative number when the first argument is less than the second one, zero when they're equivalent, and a positive number when it is more than the second one.

Swift 4+Foundation, 160 bytes (142+18), 155 bytes (142+13)
Import (13 bytes, including ; to separate from the code):
This will import Foundation, but is 5 bytes shorter than import Foundation.
import UIKit;

Header (not counted: the code is non-recursive):
let f:(String,String)->ComparisonResult =

Code (142 bytes):
{var x={($0 as String).split{$0=="."}.count},a=$0,b=$1
while x(a)<x(b){a+=".0"}
while x(b)<x(a){b+=".0"}
return a.compare(b,options:.numeric)}

Try it online!
Explanations

We append some trailing .0 for same number of components.
We compare components numerically.

Returned constants

ComparisonResult.orderedSame for =
ComparisonResult.orderedAscending for <
ComparisonResult.orderedDescending for >

I'm not sure if we count the import statement, so I posted a separate answer that doesn't require Foundation and with a bytes count in-between 142 bytes (not counting import) and 160 bytes (counting import).

Swift 4, 155 bytes
Header (not counted: the code is non-recursive):
let f:(String,String)->Bool? =

Code
{let x:(String)->[Int]={$0.split{$0=="."}.map{Int($0)!}.reversed().drop{$0==0}.reversed()},a=x($0),b=x($1)
return a==b ?nil:a.lexicographicallyPrecedes(b)}

Try it online!
Explanations

We trim trailing .0.
We compare components numerically.

Returned constants

nil for =
true for <
false for >

JavaScript 64 bytes
a=>b=>(e=i=>(g=v=>v.split`.`[i]||0)(a)-g(b)||!a[i]-1&&e(i+1))(0)

Try it online!
With comments:
a=>b=>(                            // Main function takes arguments like ("1.2.42")("1.2.41")
    e=i=>                          // e(i) compares the ith number, returns >0, <0 or =0.
        (   g=v=>v.split`.`[i]||0  // g() returns the ith string or 0
        )(a)                       // call g(a)
        -g(b)                      // subtracting g(b) from g(a) casts strings to integer
        ||                         // If they are not equal return result now
        !a[i]-1 &&                 // recursion limited to a.length, always sufficient
        e(i+1)                     // next i
    )(0)                           // Start with i = 0

Perl 5, 55 bytes
sub c{@_<2?sprintf"%9d"x9,split/\./,pop:-(c(pop)cmp c(pop))}

Try it online!

Burlesque - 17 bytes
wd{'.;;)ri}m[^pcm

blsq ) "2018.08.1 2018.08"wd{'.;;)ri}m[^pcm
1
blsq ) "0.0.1 0.1"wd{'.;;)ri}m[^pcm
-1
blsq ) "1.1.56789 1.2.0"wd{'.;;)ri}m[^pcm
-1

If you want output in '><=' then add ?i"<=>"j!!Q.

Powershell, 88 bytes
Returns 0 for equal, a positive integer for greater than or a negative integer for less than.
param($a,$b)+(($x=$a-split'\.')+($y=$b-split'\.')|%{$x[+$i]-$y[$i++]}|?{$_}|Select -f 1)

Less golfed test script:
$f = {

param($a,$b)
$x=$a-split'\.'
$y=$b-split'\.'
$z=$x+$y|%{
    $x[+$i]-$y[$i++]
}|?{$_}|Select -first 1
+$z             # convert $null to 0

}

@(
    ,("2"         ,"1"         , 1)
    ,("1.0.0"     ,"1"         , 0)
    ,("1.0"       ,"1.0.0"     , 0)
    ,("1.2.42"    ,"1.2.41"    , 1)
    ,("1.1.56789" ,"1.2.0"     ,-1)
    ,("1.10"      ,"1.2"       , 1)
    ,("1.20"      ,"1.150"     ,-1)
    ,("18.04"     ,"18.4"      , 0)
    ,("7.010"     ,"7.8"       , 1)
    ,("1.0.0.1.0" ,"1.00.00.2" ,-1)
    ,("00.00.01"  ,"0.0.0.1"   , 1)
    ,("0.0.1"     ,"0.1"       ,-1)
    ,("42.0"      ,"4.2.0"     , 1)
    ,("999.999"   ,"999.999.1" ,-1)
    ,("2018.08.1" ,"2018.08"   , 1)
) | % {
    $v1,$v2,$expected = $_
    $result = &$f $v1 $v2
    "$([Math]::Sign($result)-eq$expected): $result"
}

Output:
True: 1
True: 0
True: 0
True: 1
True: -1
True: 8
True: -130
True: 0
True: 2
True: -1
True: 1
True: -1
True: 38
True: -1
True: 1

Dart, 277 231 bytes
F(s,{t}){t=s.split('.').map(int.parse).toList();while(t.last<1)t.removeLast();return t;}f(a,b,{d,e,f,g,h,i=0}){d=F(b);e=F(a);g=d.length;h=e.length;f=h>g?g:h;for(;i<f;i++)if(e[i]!=d[i])return e[i]>d[i]?1:-1;return h>g?1:(h<g?-1:0);}

Try it online!

-44 bytes by using variables to store length and using ternary in loop
-2 bytes by removing the for brackets

Zsh, 54 50 bytes
-4 bytes by using $@ instead of $1\ $2
eval {autoload,}' is-at-least $'{@,2\ $1}';<<<$?;'

Try it online!

Try it online!
This evals to the following eight statements:
autoload is-at-least $@       # loads the "is-at-least" function
<<<$?                         # success, prints 0
autoload is-at-least $2 $1    # redundant
<<<$?                         # success, prints 0
is-at-least $@                # exits 1 if $1 < $2
<<<$?
is-at-least $2 $1             # exits 1 if $2 < $1
<<<$?

So the three unique values are:
 cmp |  value
-----+------------------------------------------
  =  |  0<newline>0<newline>0<newline>0<newline>
  <  |  0<newline>0<newline>1<newline>0<newline>
  >  |  0<newline>0<newline>0<newline>1<newline>

Jelly, 11 bytes
ṣ€”.Vz0I¬ÞḢ

Try it online!
May be stretching the rules a little, but going by this I/O default, it's allowed. This uses the output presentation:

Use positive number / zero / negative number, while zero means equal;

but the output is wrapped as a singleton array
How it works
ṣ€”.Vz0I¬ÞḢ - Main link. Takes a pair of versions [a, b] on the left
 €          - Over each:
ṣ ”.        -   Split on "."
    V       - Evaluate each numeric string to a number
     z0     - Transpose, filling with 0s
       I    - Take the differences of each pair
        ¬Þ  - Sort by logical NOT
              This shuffles 0 to the end and preserves the order of everything else
          Ḣ - Take the first element

Perl 5 -plF\., 50 bytes
@b=<>=~/\d+/g;1while@F+@b&&!($_=shift@F<=>shift@b)

Try it online!
Takes input on two lines.

Output
Meaning

1
First version is greater

0
Versions are equal

-1
Second version is greater

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Indent your code according to Fibonacci
Okay, so I saw this in a meme and decided it'd be the perfect code golf challenge:
I prefer to increase the side of my indents according to the Fibonacci sequence:
class Kls
 def method
  t = Time.now
  if t.hour >= 12
    puts "It's afternoon"
    if t.hour == 18
       puts "It's time for your meal of:"
       %w(bread sausage brocolli milk).each do |food|
            "Some #{food}"
       end
    end
  else
    puts "It's not afternoon"
  end
 end
end

This means each line is indented by the sum of the spaces indented in the previous indentation-level. The first indention-level is indented by one space, then subsequent indention-levels are indented by 1, 2, 3, 5, 8, 13, 21, etc additional spaces.
The challenge
Given a multi-line string with multiples of 2 spaces as indentation, convert it to a Fibonacci indented multi-line string instead.
This means every line with 0 indented spaces will remain 0 spaces; every line with 2 indented spaces will become 1 instead (sum of the first two Fibonacci numbers 0+1 = 1); every line with 4 indented spaces will becomes 2 instead (sum of the first three Fibonacci numbers 0+1+1 = 2); etc. So the number of indentations can be calculated as follows:

Get the current amount of leading spaces (guaranteed to be a multiple of 2, so [0,2,4,6,8,...])
Divide this by 2, so we have our 0-indexed numbers (let's call it n)
Get the first [0,n] (0-indexed) Fibonacci numbers
Sum that sub-sequence together, and use that amount of leading spaces instead in the output

For example, for the output above, the input would have been:
class Kls
  def method
    t = Time.now
    if t.hour >= 12
      puts "It's afternoon"
      if t.hour == 18
        puts "It's time for your meal of:"
        %w(bread sausage brocolli milk).each do |food|
          "Some #{food}"
        end
      end
    else
      puts "It's not afternoon"
    end
  end
end

If we take a look at the line containing "Some #{food}":
In the input it has 10 amount of leading spaces, so n will be 10/2 = 5. The first [0,5] Fibonacci numbers are: [0,1,1,2,3,5]. When we take the sum of that list (0+1+1+2+3+5) the new amount of leading spaces in the output would be 12.
The amount of indented spaces in the output for every 2 indented spaces in the input will be [0, 1, 2, 4, 7, 12, 20, 33, 54, 88, ...] A000071 on oeis.org (except for the first 0).
Challenge rules:

The space-indentation of the input is guaranteed to be multiples of 2 ([0,2,4,6,8,...])
The input is guaranteed to not contain more than 1 consecutive space elsewhere (except for the leading indentation of course)
Use whatever language you like
Please include a link to an online interpreter
Input should be a multi-line string (so no, string-lists/arrays aren't allowed)
Output should also be a multi-line string (either printed or returned as string)
Your method should work for deeper-indented Fibonacci indented multi-line strings than the example
This is code-golf, so try to do it in the fewest bytes possible.

Additional test cases:
Input:
this
  is
    one
      of
        the
          tests
            !

Output:
this
 is
  one
    of
       the
            tests
                    !

Input:
      And
  how
               about
        this ?

Output:
    And
 how
                                 about
       this ?

Input:
                    20 spaces?

Output:
                                                                                20 spaces?

What if there's 2 or more spaces in the code that aren't part of the indentation?

@AJFaraday I took the liberty of editing your challenge so it can be re-opened. The challenge in general is a nice idea and I personally like it; it was just not properly explained. If you see anything incorrect in what I've edited, let me know.

05AB1E (legacy), 22 21 bytes
|εDgsðÛ©g-;LÅfOð*®J}»

Try it online.
21 bytes alternative using the formula \$Fib(\frac{n}{2}+2)-1\$ instead of \$\sum_{i=1}^{i=\frac{n}{2}}{Fib(i)}\$ :
(Credit to @JonathanAllan's Jelly answer for this formula.)
|εDgsðÛ©g-;ÌÅf<ð*®J}»

Try it online.
Explanation:
|                        # Take the input split by newlines
 ε                  }    # Map each line to:
  Dg                     #  Duplicate the line and take its length
    s                    #  Swap so the duplicated line is at the top of the stack again
     ðÛ                  #  Remove all leading spaces
       ©                 #  Store the result in the register (without popping)
        g                #  Take its length as well
         -               #  Subtract both lengths from each other
          ;              #  Halve it, because they are multiples of 2 indented spaces
           L             #  Create a list in the range [1, n]
            Åf           #  Get the i'th Fibonacci number for each
              O          #  And sum them together
               ð*        #  Have that many space characters
                 ®J      #  And join them with the saved string from the register
                    »    # And finally print the mapped list with new-lines

Jelly, 20 bytes
Ỵµ=⁶i0‘H‘ÆḞ’⁶ẋ;t⁶$)Y

Try it online!

Explanation
Let \$x\$ be the 1-indexing index of the first non-whitespace character (\$1,3,5,7,\dots\$).
Then the new indent is
$$F_{(x+1)/2+1}-1$$
where \$F\$ is the Fibonacci function.

Save 1 from both with Ỵµ...)Y

Python 2, 111 109 100 95 bytes
g=lambda n:n<1or g(n-2)+g(n-4)
def f(I):
 for l in I:L=l.lstrip();print~-g(len(l)-len(L))*' '+L

Try it online!

Saved:

-5 bytes, thanks to ovs.

g can be g=lambda n:n<1or g(n-2)+g(n-4).

and you can use strip instead of lstrip as trailing whitespace is insignificant.

@ovs But it would affect len(l)-len(L).

Husk, 23 bytes
mȯF+M(R' !∫Θİf→½L)↕=' ¶

Try it online!
Explanation
m(F+M(R' !∫Θİf→½L)↕=' )¶  -- full program
                       ¶  -- lines
m(                    )   -- map
                  ↕='     -- | split on first non-space
    M(           )        -- | with the spaces
                L         -- | | length
               ½          -- | | halve
              →           -- | | increment
            İf            -- | | Fibonacci numbers: [1,1,2,3,5..]
           Θ              -- | | prepend 0: [0,1,1,2,3,5..]
          ∫               -- | | cumulative sums: [0,1,2,4,7,12..]
         !                -- | | 1-based index
      R'                  -- | | replicate that many spaces
  F+                      -- | join

This answer appears to have three levels of indent with only 1 space, then continuing in Fibonacci.

I had the same mistake at first. Instead of having the indexed Fibonacci amount of spaces in the result, it's actually the sum of the first [1,n] amount of Fibonacci numbers. So instead of [0,1,1,2,3,5,8,...] indented spaces, it's (sum_each([0,[0,1],[0,1,1],[0,1,1,2],[0,1,1,2,3],[0,1,1,2,3,5],[0,1,1,2,3,5,8],...]) -> [0,1,2,4,7,12,20,...] indented spaces instead.

@KevinCruijssen: I was able to fix it w/o additional bytes, thanks a lot!

Retina 0.8.2, 37 bytes
m`^

+`( +	)( +)
$2$1$1
 	 *

Try it online! Warning: Lots of white space. Explanation:
m`^

Prefix each line with space tab space tab. These keep track of the previous and current Fibonacci number.
+`( +   )( +)
$2$1$1

For each two spaces of the original indentation, compute the next Fibonacci number by summing the previous two.
 	 *

Subtract 1 from the result and delete the previous Fibonacci number.

Japt v2.0a0, 20 19 bytes
r/^ +/m@ÓMgXÊz ÄÄ)ç

Try it

Explanation
r                        :Replace
 /^ +/m                  :Global, multiline regular expression matching one or more spaces at the start of each line
       _                 :Pass each match through a function
        Ê                :  Length
         z               :  (Floor) divide by 2
           õ             :  Range [0,result]
              @          :  Map each X
               MgX       :    Xth Fibonacci number
                  Ã      :  End mapping
             x           :  Reduce by addition
                   ç     :  Repeat <space> that many times

Jelly, 17 bytes
Ỵµwt©⁶$HÆḞ€⁶ẋ;®)Y

A full program which prints the result.
Try it online!
How?
The indentations required for a line of the output is \$Fib(\frac{s}{2}+2)-1\$ where \$s\$ is the number of spaces in the line of the input, and:
$$Fib(\frac{s}{2}+2)-1=\sum_{i=1}^{i=\frac{s}{2}}{Fib(i)}$$
(\$i\$ could also start at \$0\$ since \$Fib(0)=0\$)
Ỵµwt©⁶$HÆḞ€⁶ẋ;®)Y - Main Link: list of characters
Ỵ                 - split at newlines
 µ             )  - for each line:
      $           -   last 2 links as a monad:
     ⁶            -     literal space character
   t              -     trim from both sides
    ©             -     (copy to register)
  w               -   first index of that substring in the line
       H          -   halve (this is (s+1)/2)
        ÆḞ€       -   Fibonacci of €ach (using an implicit range [1,2,...,s/2]
                  -                      where the (s+1)/2 is floored to s/2)
           ⁶      -   literal space character
            ẋ     -   repeat (vectorises) (e.g. [1,1,2,3,5] -> [[' '],[' '],[' ',' '],[' ',' ',' '],[' ',' ',' ',' ',' ']]
              ®   -   recall from register
             ;    -   concatenate
                Y - join with newline characters
                  - implicit print
                  -  ...smashes, so e.g. [[' '],[' '],[' ',' '],['x']] is just "    x"

Java 11, 150 bytes
s->{for(var l:s.split("\n"))System.out.println(" ".repeat(f(l.length()-(l=l.stripLeading()).length())-1)+l);};int f(int n){return n<1?1:f(n-2)+f(n-4);}

Try it online (NOTE: Both String.repeat(int) and String.stripLeading() are emulated as repeat(String,int) and stripLeadingE(String) respectively, because Java 11 isn't on TIO yet.)
Explanation:
s->{                   // Method with String parameter and no return-type
  for(var l:s.split("\n"))
                       //  Loop over the lines of the input:
    System.out.println(//   Print with trailing new-line:
      " ".repeat(      //    Repeat a space this many times:
           f(          //     Call the separated (recursive) method `f` with the parameter:
             l.length()//      The length of the line,
             -(l=l.stripLeading()).length()
                       //      minus the length of the line without leading spaces
           )-1         //     minus 1
      )+l);};          //    And append the line without leading spaces

int f(int n){          // Separated method with integer as both parameter and return-type
  return n<1?          //  If the input is 0 or lower:
          1            //   Return 1
         :             //  Else:
          f(n-2)+f(n-4);}
                       //   Return a recursive call to `n-2` plus a recursive call to `n-4`

JavaScript (Node.js), 87 81 bytes
x=>x.replace(/^ */gm,s=>" ".repeat((g=(n,a=b=1)=>n?g(n-2,b,b+=a):b-1)(s.length)))

Try it online!
For small indent levels (up to 15), 61 bytes using approximation:
x=>x.replace(/^ */gm,s=>" ".repeat(1.272**s.length*1.171-.5))

Use 1.27202 ** s.length * 1.17082 - .5 for indents up to 21 levels

Perl 6, 62 bytes
*.trans(/[\n|^]' '+/=>{"\n"~' 'x(1,1,*+*...*)[$/.ords/2+1]-1})

Try it online!

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
Prime numbers in large number
Given a large number (in base 10), such as 1234567891011121314151617, find prime "subnumbers" in it.
A prime "subnumber" is a consecutive sequence of digits (taken from the input), which represents a prime number (in base 10).

Input:
A number (either a string, a file, or whatever you like).
Output:
All prime subnumbers separated somehow (either in a list, a file, comma-separated strings...)
If the result is empty, you can take any convention you like (hardcoded string, empty string, gibberish, but program should not crash.
Example
1234 -> 2, 3, 23
6542 -> 5, 2
14 -> [.. empty output]

This is code-golf. The shortest program wins!
[edit] : additional rule, program must be explained! Not everybody is fluent in Jelly :)

Welcome to PPCG!

Extremely related.

Must duplicates be included, excluded, or may we do either?

not specified. Do whatever you like.

For future reference using an @ you can notify one user (like @JonathanAllan)

Tip: That's too soon to be accepting an answer; it can discourage others from posting solutions.

@RegisPortalez welcome, and nice challenge! I've found that the "accept" feature isn't used all that much anymore on PPCG the way it is on the other sites in the network. We tend to value nice answers in any language.

@Shaggy you're right. 05AB1E solution will probably be accepted later on though :)

Can we take a vector of digits as input ? e.g. [1,2,3,4] for 1234 ?

@digEmAll : « or whatever you like » . Yes you can

@RegisPortalez: needed to be sure, thanks :)

05AB1E (legacy), 3 bytes
Œʒp

Try it online!
Substrings of the input that are prime.

That will be hard to make shorter :)

Right language for this task

This is 3 characters, but not 3 bytes, no?

@mob That depends on the encoding. In the 05AB1E encoding, this answer is 3 bytes long.

According to this, 34567 = 13*2659 is prime, seems wrong : https://tio.run/##yy9OTMpM/f//6KRTkwr@/zc2MTUzBwA

@frosqh It's actually a bug of the p (prime) function in the new 05AB1E release: https://tio.run/##yy9OTMpM/f//6KRTkwr@/zc2MTUzBwA
It's already been fixed in the repository but hasn't been pushed on TIO. I've switched my answer to the legacy version in the meantime.

Perl 6, 28 bytes
{grep &is-prime,+«m:ex/.+/}

Try it online!
The :ex ("exhaustive") flag to the match operator m makes it return every possible match of .+ (ie, every substring of one or more characters), even overlapping ones.  The hyperoperator +« turns that list of Match objects into numbers, which are then filtered for primeness by grep &is-prime.

Here I was going to go with {+«m:ex/(.+)<?{$0.is-prime}>/}

@BradGilbertb2gills I tried that too!  I'm a little disappointed it turned out to be longer.

Thanks for explaining - always helpful to Perl 4 dinosaurs like me!

Python 2, 66 65 bytes
P=k=1
n=input()
while~n+k:
 if`k`in`n`>0<P%k:print k
 P*=k*k;k+=1

Try it online!

Should be while k<=n or, to cost 0 bytes, while~n+k

@JonathanAllan thank you. At first I thought the number itself should be excluded from the output, but it seems like this isn't the case.

@JonathanAllan Can you explain please the code from the while statement? I haven't seen this type of codes before. Also haven't seen use of `` , what it does?

@taritgoswami while stmt: will run as long as stmt has a value that is considered truthy by python. The only falsy integer in Python is 0. Therefore the code will run as ~n+k != 0. ~ is the bitwise complement operator, and ~n is equivalent to -n - 1. ~n + k != 0 <=> -n - 1 + k != 0 <=> k != n + 1. As we are incrementing k by 1 in every operation, k != n + 1 is in this case equivalent to k <= n.

@taritgoswami And \n`is the same asrepr(n)` in Python 2. (does not work in Python 3).

@ovs: I have trouble to grasp the mathematical principle behind the use of P*=k*k / P%k>0... is it perhaps a corollary to the Euclid's Lemma ?

@digEmAll This is based on Wilson's theorem. P keeps track of (k-1)! ^ 2, while k iterates through all integers between 1 and n. A explanation of this method can be found in this answer.

@ovs: thanks, very useful !

Brachylog, 4 bytes
-1 byte thanks to Kroppeb.
sᶠṗˢ

Try it online!
ᶠind all substrings, ˢelect the ṗrimes

sᶠṗˢ is one byte shorter. It finds all substrings and returns those which are prime.
See here https://codegolf.stackexchange.com/a/117871/81957

Japt, 13 10 bytes
Thanks @Shaggy -3 bytes
ò fj f@søX

ò fj f@søX              Full program
                        implicity input
ò                       inclusive range [this - 1]
  fj                    filter primes and
     f@søX              values contained in input

Try it online!

10 bytes

Jelly,  5  4 bytes
-1 thanks to Kevin Cruijssen (Ẓ is an alias for ÆP)
ẆḌẒƇ

A monadic Link accepting a list of digits* which yields a list of prime integers.
* going by "either a string, a file, or whatever you like" - to take an integer, prefix the code with a D
Try it online!
How?
ẆḌẒƇ - Link: list of integers (digits)   e.g. [1,2,3,4]
Ẇ    - non-empty contiguous substrings        [[1],[2],[3],[4],[1,2],[2,3],[3,4],[1,2,3],[2,3,4],[1,2,3,4]]
 Ḍ   - convert to decimal (vectorises)        [1,2,3,4,12,23,34,123,234,1234]
   Ƈ - filter keep if:
  Ẓ  -   is prime?                            [2,3,23]

ÆP can be Ẓ if I'm not mistaken?

Ah yes that is one of the new aliases - thanks!

Java 8, 148 147 bytes
n->{for(int l=n.length(),i=l,j;i-->0;)for(j=l;j>i;){long k=2,x=new Long(n.substring(i,j--));for(;k<x;x=x%k++<1?0:x);if(x>1)System.out.println(x);}}

Try it online.
Explanation:
n->{                     // Method with String parameter and no return-type
  for(int l=n.length(),  //  Length of the input-String
          i=l,j;         //  Temp-integers
      i-->0;)            //  Loop `i` in the range [length, 0)
    for(j=l;j>i;){       //   Inner loop `j` in the range [length, 0)
      for(long k=2,      //    Set `k` to 2
               x=new Long(n.substring(i,j--)
                         //    Take the substring [`i`, `j`) from the input,
            );           //    convert it to a long, and set it as `x`
          k<x;           //    Inner loop as long as `k` is still smaller than `x`
        x=x%k++<1?       //     If `x` is divisible by `k`:
           0             //      Set `x` to 0
          :              //     Else:
           x);           //      Leave `x` unchanged
      if(x>1)            //    If `x` is now larger than 1 (a.k.a. If `x` is a prime):
        System.out.println(x);}}
                         //     Print `x` with a trailing newline to STDOUT

MATL, 9 bytes
&XfXUtZp)

Try it online!
Explanation
&Xf   % Implicit input: string. Push cell array of non-empty substrings
XU    % Convert to number. Vectorizes
t     % Duplicate
Zp    % Isprime. Vectorizes.
)     % Index. Keeps substrings indicated by the previous result. Implicit display

Bash + GNU Core Utils: 80 77 Bytes
for i in $(seq `tee a|wc -c`)
{
grep -oE .{$i}<a|factor|grep -oP ': \K\d+$'
}

This cannot be the shortest, but I am having trouble coming up with anything better. Help wanted!
By sticking to only POSIX, I got 82:
for i in $(seq `tee a|wc -c`)
{
grep -oE .{$i}<a|factor|awk -F\  'NF<3{print$2}'
}

Could Bash string slicing help?  It's a shame brace ranges are expanded before parameters...

@TobySpeight that would require two loops (one for the start, one for the end), not to mention you can't use variables inside of a slicing substitution. Zsh allows it, though! The main route to shortness in my mind is to use Awk to generate all the substrings.

R, 60 bytes
function(v)Filter(function(i)grepl(i,v)&sum(!i%%1:i)==2,1:v)

Try it online!
Not really efficient, inspired by @ovs python 2 answer

Awesome! funprog rules!

Vyxal Ṡ, 4 bytes
ǎE~æ

Try it Online!
ǎE~æ # 'Ṡ' flag makes Vyxal take all input as strings
ǎ    # All substrings
 E   # Convert to numbers
  ~æ # Remove non-primes

Curry (KiCS2), 61 58 bytes
-3 bytes thanks to Wheat Wizard!
Takes input as a string, returns integers. f is function which can return any of the results.
p n|n>1&&all((>0).mod n)[2..n-1]=n
f(_++a:b++_)=p$read$a:b

You can try this on Smap (select KiCS2 2.2.0 /all-values) by adding:
main = f "1234"

p is a primality test function which returns it's input if it is a prime, and doesn't return anything otherwise.
f(_++a:b++_) matches non-empty substrings of the input in a:b and f returns the value of p applied to a:b converted to integer.
Local output:
> f "1234"
[...]
Evaluating expression: f "1234"
2
23
3

Python 2, 115 114 bytes
f=lambda s:s and[n for n in[int(s[j:])for j in range(len(s))]if n>1and all(n%i for i in range(2,n))]+f(s[:-1])or[]

Try it online!

if~-n*all(n%i for i in range(2,n)) saves 4.

Wolfram Language (Mathematica), 40 bytes
Select[PrimeQ@*FromDigits]@*Subsequences

Try it online!
Input and output are lists of digits. In the case of no prime subnumbers the empty list {} is returned.
Uses @* for Composition of functions. Subsequences gives a list of all subsequences of the input, and Select[PrimeQ@*FromDigits] is an operator form of Select which returns a list of all elements for which PrimeQ@*FromDigits returns True.

Husk, 5 bytes
foṗiQ

Try it online!

Clean, 108 bytes
import StdEnv,Data.List
$s=nub[n\\u<-inits s,n<-map(toInt o toString)(tails u)|n>1&&all(\m=n/m*m<n)[2..n-1]]

Try it online!

Pyth, 8 bytes
fP_TsM.:

Test suite
Takes the input as a string, outputs a list of integers. Can also take input as an int by adding ` at the end for an extra byte.
Explanation:
fP_TsM.:  | Full code
fP_TsM.:Q |  with implicit variables added
          | Print (implicit)
      .:Q |  list of all substrings of the input
    sM    |   converted to integers
fP_T      |    filtered for prime numbers

And ` just converts int to str.

Matlab, 89 bytes
function[m]=f(x),m=1;for i=1:length(x),m=[m;str2num(combnk(x,i))];end,m=m(isprime(m));end

Try it Online!


text:
Seven Segment Scrolling
Sandbox Post
Intro
The information panels are everywhere. When the technology became cheaper, the paper posters were transformed into luminous signs that show words that appear on one side and come out on the other, like the one on the figure:

When one of these signs starts up, it usually starts empty and the text leaves from the right side to the left, moving until it disappears.
Its functionality is to go on and off the small light bulbs (LEDs) to give the sensation of movement.
If instead of text we only need to show numbers, the poster can be much less sophisticated using the so-called seven-segment markers like the following:

In this case each number is represented by the combination on / off of only 7 light segments that allow to represent all the numbers:

The question we ask ourselves is how many changes of lights (how many on and off) should be made to pass through one of these posters a certain number?
For example, to show the 123 in a 3-digit sign that starts with all the LEDs off we will have:

This makes a total of 42 changes of lights.

Challenge
Given a non-negative number and a positive sign length calculate the number of lights changes.
Rules

Assume input consist in a non-negative number (N >= 0) and a positive sign length (M > 0)
Assume Sign length >= Number length (M >= digits(N))

Test cases
123, 3        => 42
45, 5         => 60
111, 3        => 12
98765, 10     => 220
0, 3          => 36

What's the goal of the question? In reality, a part like MAX7219 will control the 8 digits, to have them displayed you would just send the 8 digits to the MAX7219 via SPI commands. The decimal point 8th bit from 1 or 2 digits would be used to for the -/+ light. For instance, 4 could be daisychained to make an 8 x 32 dot display to scroll text across, like this one I made: https://www.youtube.com/watch?v=hwYqgyMc5S4

https://en.wikipedia.org/wiki/Seven-segment_display#Displaying_letters useful link

@CrossRoads Actually this is not intended for a real hardware answer or anything like this. It is a challenge to create an algorithm which can output the number of lights changes of a given number in multiples 7-segment displays

Suggested test case: 0,3 => 36

May we take the first integer as a string, or list of digits?

@Οurous no, you must take both inputs as integer

I'm with @CrossRoads - it's a pointless challenge as no hardware would ever work this way.

@Alnitak This is not intented to work in real world. It is just a programming challenge. Nothing to do with how real hardware works.....

Python 2, 129 126 119 104 bytes
def f(n,k,p=0):z=p<1or n>0;q=-~ord('}/lx2Z^o~z'[n%10])*z;return(z and f(n/10,k,q))+k*bin(p^q).count('1')

Try it online!
Thx for a big 15 bytes from ovs.
As specified, takes a non-negative number and a positive sign length, and returns total changes.

What the actual fuck is this sorcery. You are a Python Lord. I get so happy getting my code under 200 bytes then you show up with '7367355777e0d93bf0fb'

@Rushabh Mehta: Heh heh. Well, I'm only standing on the shoulders of giants. Check out these tips posted by the true Jedi Knights. The string strategy I learned from here.

104 bytes or 102 bytes with an unprintable (\x7f) between p and {.

JavaScript (Node.js), 104 94 93 93 bytes
Saved 1 byte thanks to @Shaggy
B=n=>n&&n%2+B(n>>1)
F=(d,w,q)=>w*B(q^(q=d&&"w`>|i]_p}".charCodeAt(d%10)))+(d&&F(d/10|0,w,q))

Try it online!

I think this works for -1 byte.

@Shaggy Nice trick, thanks!

OP has clarified that both inputs must specifically be integers (and not lists of digits or strings)

@Οurous Thanks, fixed at +0 bytes.

Also, I think 0,3 should give 36; you give 0. (I had the same problem - fixing this cost me about 10 bytes grrrr... :) ).

You can save 3 bytes by using Buffer().

Jelly, 23 bytes
Dị“¤]þ+>~Œ¶?w‘Ø0j^ƝBFS×

A dyadic link accepting the integer to display on the left and the sign length on the right which yields the number of changes (also works if the number of digits in the integer to display is greater than the sign length).
Try it online!
How?
During the entire show each 7-segment display (at some point) transitions from empty to the first digit, then to the second and so on, and finally from the last to empty again. The transitions each cost the bitwise XOR of the on-segments of the from-digit and to-digit (where empty is a "digit" with 0 on-segments). I stole the on-segments as integers from a previous revision of ETHproductions' answer, but any permutation of the 7 segments would do just as well.
Dị“¤]þ+>~Œ¶?w‘Ø0j^ƝBFS× - Link: integer to display, V; integer sign length, L  e.g. 123, 3
D                       - cast V to decimal digits                                  [1,2,3]
  “¤]þ+>~Œ¶?w‘          - code-page indices list = [3,93,31,43,62,126,19,127,63,119]
 ị                      - index into (1-based & modular) (vectorises)             [3,93,31]
              Ø0        - literal = [0,0]                                             [0,0]
                j       - join                                                [0,3,93,31,0]
                  Ɲ     - pairwise application of:
                 ^      -   bitwise XOR                                        [3,94,66,31]
                   B    - convert to binary digits (vectorises)               [[1,1],[1,0,1,1,1,1,0],[1,0,0,0,0,1,0],[1,1,1,1,1]]
                    F   - flatten                                             [1,1,1,0,1,1,1,1,0,1,0,0,0,0,1,0,1,1,1,1,1]
                     S  - sum                                                            14
                      × - multiply by L                                                  42

Could you save a byte by taking the number as a digit array? https://tio.run/##ATsAxP9qZWxsef//4buL4oCcwqRdw74rPn7FksK2P3figJjDmDBqXsadQkZTw5f///9bOSw4LDcsNiw1Xf8xMA

Yes, but "Given a non-negative number" and "input consist in a non-negative number" seemed strict to me.

Japt, 31 30 bytes
Adapted from Jonathan's Jelly solution. Takes input in reverse order with the number to be displayed as a digit array.
*Vm!c"w]+>~?" pT ä^T x_¤¬x

Try it

OP has clarified that both inputs must specifically be integers (and not lists of digits or strings)

Clean, 280 bytes
import StdEnv,Data.List
~ =toInt
?s=sum[(~s>>p)rem 2\\p<-[0..6]]
$n l#j=repeatn l 0
#n=j++[~c-47\\c<-:toString n]++j
#k=[getItems(map((!!)[0,119,3,62,31,75,93,125,19,127,95])n)[i-l..i-1]\\i<-[0..length n]]
=sum(zipWith@(tl k)k)
@[u][]= ?u
@[u:x][v:y]= ?((bitxor)u v)+ @x y
@[][]=0

Try it online!
There has to be a shorter way..

Charcoal, 40 bytes
≔⁺×⁷0⭆Ｓ§⪪”)∧？？%←⁶%*An”⁷ＩιθＩ×ＮΣＥθ¬⁼ι§θ⁺⁷κ

Try it online! Link is to verbose version of code. Works by converting the input into the binary segment values, then counting the number of changes between each character. Explanation:
      Ｓ                     Convert first input to string
     ⭆                      Map over digits and join
         ”)∧？？%←⁶%*An”      Compressed segment value string
        ⪪             ⁷     Split into groups of seven characters
                        ι   Current digit
                       Ｉ    Convert to integer
       §                    Index into groups
    0                       Literal `0`
  ×⁷                        Repeat seven times
 ⁺                          Concatentate
≔                        θ  Assign to variable `q`

     θ          Variable `q`
    Ｅ           Map over characters
             κ  Current index
           ⁺⁷   Add seven
          θ     Variable `q`
         §      Cyclically index
        ι       Current character
       ⁼        Compare
      ¬         Logical not
   Σ            Sum results
  Ｎ             Second input
 ×              Multiply
Ｉ               Cast to string
                Implicitly print

JavaScript (Node.js), 88 bytes
Takes input as (integer)(width).
n=>w=>[...n+'',g=n=>n&&1+g(n&n-1)].map(c=>s+=g(x^(x=Buffer('w$]m.k{%o')[c])),x=s=0)|s*w

Try it online!
How?
Given a list \$\{d_1,d_2,\dots,d_n\}\$ of \$n\$ digits and a display width \$w\$, the total number \$N\$ of light changes is given by:
$$N=({T'}_{d_1}+\sum_{i=2}^n{T_{d_{i-1},d_i}}+{T'}_n)\times w$$
Where \$T_{x,y}\$ is the number of light changes for a transition from digit \$x\$ to digit \$y\$ and \${T'}_{x}\$ is the number of light changes for a transition from the blank digit to digit \$x\$ (or the other way around).
Commented
n => w =>                       // n = integer; w = width of display
  [ ...n + '',                  // coerce n to a string and split it
    g = n =>                    // g = helper function counting the number of 1's
      n && 1 + g(n & n - 1)     // by defining it here, we also force an extra iteration
  ]                             // with an undefined digit (interpreted as the blank digit)
  .map(c =>                     // for each entry c in this array:
    s += g(                     //   add to s the result of a call to g():
      x ^ (x =                  //     XOR the previous value of x
        Buffer('w$]m.k{%?o')[c] //     with the new one, picked from a 10-entry lookup
      )                         //     gives undefined (coerced to 0) for the last entry
    ),                          //   end of call to g()
    x = s = 0                   //   start with x = 0 and s = 0
  ) | s * w                     // end of map(); return s * w


text:
How long to cross the bridge?
Introduction
There is a group of people that have to cross a rickety bridge that can only support two people at a time. It is a dark and foggy night, but unfortunately, the group only has one lamp. The bridge must be crossed by an individual or pair that is holding the lamp. When a pair is traveling together, they must move at the pace of the slower individual.
The goal is to write a function that takes the travel time of each individual and outputs the minimum travel time of the group.

Example
If the input list is [1, 2, 5, 10], the output should be 17, because the minimum crossing time is this order:
1 and 2 cross together  (2 minutes)
1 crosses back          (1 minute)
5 and 10 cross together (10 minutes)
2 crosses back          (2 minutes)
1 and 2 cross together  (2 minutes)

and 2 + 1 + 10 + 2 + 2 = 17.

Data
input             | output
------------------+-------
[1]               | 1
[1,2]             | 2
[1,2,3]           | 6
[1,2,3,4]         | 11
[1,2,3,4,5]       | 16
[1,2,3,4,5,6]     | 22
[1,2,3,4,5,6,7]   | 28
[1,2,3,4,5,6,7,8] | 35
[1,2,5,10]        | 17
[1,1,1,1]         | 5
[1,1,1,1,1]       | 7
[2,3,5,7,11]      | 29
[3,1,4,1,5]       | 13
[2,1,7,1,8]       | 15

Challenge
Given a list of travel times, output the minimum amount of time it takes to cross the bridge.
This is code-golf, so the shortest code in bytes wins.

Are there complexity requirements?  (Can I brute-force the solution?)

Unfortunately, this is an exact duplicate of the question linked, as the answers on that challenge are valid and competitive for this one as well. Well written challenge though!