Skip to main content
added 17 characters in body
Source Link
Galen Ivanov
  • 21.2k
  • 3
  • 24
  • 61

Red, 108 bytes

func[n][i: s: 0 until[t: form i
if(t > u: sort copy t)and(t < reverse u)[s: s + i n: n - 1]i: i + 1
0 = n]s]

Try it online!

More readable:

f: func [ n ] [
    i: s: 0
    until [
       t: form i  
       if ( t > u: sort copy t ) and ( t < reverse u ) [
            s: s + i
            n: n - 1
       ]
       i: i + 1
       0 = n
    ]
    s
]

A good opportunity to use form - form i is 5 bytes shorter than to-string i

Red, 108 bytes

func[n][i: s: 0 until[t: form i
if(t > u: sort copy t)and(t < reverse u)[s: s + i n: n - 1]i: i + 1
0 = n]s]

Try it online!

More readable:

f: func [ n ] [
    i: s: 0
    until [
       t: form i  
       if ( t > u: sort copy t ) and ( t < reverse u ) [
            s: s + i n: n - 1
       ]
       i: i + 1
       0 = n
    ]
    s
]

A good opportunity to use form - form i is 5 bytes shorter than to-string i

Red, 108 bytes

func[n][i: s: 0 until[t: form i
if(t > u: sort copy t)and(t < reverse u)[s: s + i n: n - 1]i: i + 1
0 = n]s]

Try it online!

More readable:

f: func [ n ] [
    i: s: 0
    until [
       t: form i  
       if ( t > u: sort copy t ) and ( t < reverse u ) [
            s: s + i
            n: n - 1
       ]
       i: i + 1
       0 = n
    ]
    s
]

A good opportunity to use form - form i is 5 bytes shorter than to-string i

added 76 characters in body
Source Link
Galen Ivanov
  • 21.2k
  • 3
  • 24
  • 61

Red, 113108 bytes

func[n][i: s: 0 until[t: form do i
if(t <>> u: sort copy t)and(t <>< reverse u)[s: s + i n: n - 1]i: i + 1
0 = n]s]

Try it online!Try it online!

More readable:

f: func [ n ] [
    i: s: 0
    until [
       t: form do i  
       if ( t <>> u: sort copy t ) and ( t <>< reverse u ) [
            s: s + i n: n - 1
       ]
       i: i + 1
       0 = n
    ]
    s
]

A good opportunity to use form - form i is 5 bytes shorter than to-string i

Red, 113 bytes

func[n][i: s: 0 until[t: form do i
if(t <> u: sort copy t)and(t <> reverse u)[s: s + i n: n - 1]i: i + 1
0 = n]s]

Try it online!

More readable:

f: func [ n ] [
    i: s: 0
    until [
       t: form do i  
       if ( t <> u: sort copy t ) and ( t <> reverse u ) [
            s: s + i n: n - 1
       ]
       i: i + 1
       0 = n
    ]
    s
]

Red, 108 bytes

func[n][i: s: 0 until[t: form i
if(t > u: sort copy t)and(t < reverse u)[s: s + i n: n - 1]i: i + 1
0 = n]s]

Try it online!

More readable:

f: func [ n ] [
    i: s: 0
    until [
       t: form i  
       if ( t > u: sort copy t ) and ( t < reverse u ) [
            s: s + i n: n - 1
       ]
       i: i + 1
       0 = n
    ]
    s
]

A good opportunity to use form - form i is 5 bytes shorter than to-string i

Source Link
Galen Ivanov
  • 21.2k
  • 3
  • 24
  • 61

Red, 113 bytes

func[n][i: s: 0 until[t: form do i
if(t <> u: sort copy t)and(t <> reverse u)[s: s + i n: n - 1]i: i + 1
0 = n]s]

Try it online!

More readable:

f: func [ n ] [
    i: s: 0
    until [
       t: form do i  
       if ( t <> u: sort copy t ) and ( t <> reverse u ) [
            s: s + i n: n - 1
       ]
       i: i + 1
       0 = n
    ]
    s
]