g | x | w | all
Bytes Lang Time Link
022Juby250514T193235ZJordan
058JavaScript181028T154802Zguest271
008Japt181024T172012ZShaggy
015J181025T011437ZBubbler
053Python 2181024T113236Zlynn
060Scala181024T222609Zjrook
053Clean181024T215148ZΟurous
004Jelly181024T200638ZJonathan
042Haskell181024T160934Ztotallyh
052Python 2181024T170757Zovs
052Python 2181024T100055ZDead Pos
044Python 2181024T133209ZDennis
039PowerShell181024T124334ZAdmBorkB
060Python 2181024T074702ZElPedro
043JavaScript ES6181024T101421ZArnauld
010Charcoal181024T093212ZNeil
006MathGolf181024T081122ZJo King
076Java JDK181024T081053ZOlivier
00405AB1E181024T080008ZKevin Cr
006Husk181024T075639Zბიმო
006Jelly181024T074620ZATaco

J-uby, 22 bytes

:+@|:+|-[j=:join,j|:~]

Attempt This Online!

JavaScript, 58 bytes

_=>[_.map((_,i)=>t.unshift(++i),t=[]),t].map(_=>+_.join``)

Try it online!

Pass current index of array plus 1 to .unshift() to fill first array with a second array's .length, .join() each resulting array without any characters separating elements and convert to integer. Returns an array of two integers.

Japt, 9 8 bytes

Êõ ¬pÔò¶

Try it


Explanation

Ê            :Length
 õ           :Range [1,Ê]
   ¬         :Join
    p        :Concatenate
     Ô       : Reverse
      ò      :Partition
       ¶     : Between equal characters

J, 15 bytes

4(,:|.)@u:48+#\

Try it online!

How it works

4(,:|.)@u:48+#\
             #\  Generate 1-based indices of given array
          48+    Convert digits to ASCII value
4      @u:       Convert to string
 (,:|.)          Append its reverse

Python 2, 53 bytes

n=len(input())+1
b=10**n/81-n/9
print[b,10**n/90*n-b]

Try it online!

For example, for \$n=5\$: \begin{align} 12345 &= 11111 + 1111 + 111 + 11 + 1 \\ &= (11111.\bar1 + 1111.\bar1 + \dots + 1.\bar1) - (0.\bar1 \times 5) \\ &= \frac{10}{9} \left( \sum_{k=0}^{n-1} 10^{k} \right) - \frac n9 \\ &= \frac{10}{9} \left( \frac{1-10^n}{1-10} \right) - \frac{n}{9} \\ &= \frac{10^{n+1}-1}{81}-\frac{n+1}{9} \end{align}

We use integer (floor) division, so the surplus \$\frac{1}{81}\$ gets rounded away.

For the descending part, if b=12345 we compute something like 66666-12345 == 54321.

Scala (60 bytes)

def%(s:Seq[Any])={val a=(1 to s.size)mkString;(a,a.reverse)}

Try it online

Clean, 53 bytes

import StdEnv
$l#n=take(size l)['1'..]
=[n,reverse n]

Try it online!

Jelly, 4 bytes

JṚƬḌ

Try it online!

How?

JṚƬḌ - Link: list L    e.g. ['ant','bee','cat','dog','elk','frog']
J    - range of length      [1,2,3,4,5,6]
  Ƭ  - 'till (collect up until results are no longer unique):
 Ṛ   -   reverse                         1:[6,5,4,3,2,1] , 2:[1,2,3,4,5,6]=1st
     -                  ->  [[1,2,3,4,5,6],[6,5,4,3,2,1]]
   Ḍ - from base ten        [123456,654321]

Haskell, 42 bytes

-4 bytes thanks to ovs.

((,)=<<reverse).(`take`"123456789").length

Try it online!

Python 2, 52 bytes

x=0
for _ in input():x=x*10+x%10+1
print x,`x`[::-1]

Try it online!

Python 2, 55 52 bytes

a=''
for i in input():a+=`-~len(a)`
print[a,a[::-1]]

Try it online!

Explanation:

# initial value: empty string
a=''
# iterate over input
# will work with any iterable object: list, tuple, dict, set, string, etc.
for i in input():
# add to a string representation of its length+1
    a+=`-~len(a)`
# print list, composed from a and its reversed version
print[a,a[::-1]]

Python 2, 66 bytes

lambda i:`map(abs,range(-len(i),-~len(i)))`[1::3].split('0')[::-1]

Try it online!

Explanation:

lambda i:`map(abs,range(-len(i),-~len(i)))`[1::3].split('0')[::-1]

# unnamed lambda
# example input: ['q', 'w', 'e', 'r', 't']

# create range from minus length of input to length+1
# ['q', 'w', 'e', 'r', 't'] -> [-5,-4,-3,-2,-1,0,1,2,3,4,5]
                  range(-len(i),-~len(i))
# change every value in range to its absolute value
# [-5,-4,-3,-2,-1,0,1,2,3,4,5] -> [5,4,3,2,1,0,1,2,3,4,5]
          map(abs,range(-len(i),-~len(i)))
# get string representaion of list
# [5,4,3,2,1,0,1,2,3,4,5] -> '[5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]'
         `map(abs,range(-len(i),-~len(i)))`
# get each third element from string, starting from index 1, returns string
# '[5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5]' -> '54321012345'
         `map(abs,range(-len(i),-~len(i)))`[1::3]
# split string over '0', returns list of 2 values
# '54321012345' -> ['54321','12345']
         `map(abs,range(-len(i),-~len(i)))`[1::3].split('0')
# reverse list
# ['54321','12345'] -> ['12345','54321']
         `map(abs,range(-len(i),-~len(i)))`[1::3].split('0')[::-1]

Python 2, 44 bytes

s='123456789'[:len(input())]
print s,s[::-1]

Try it online!

PowerShell, 39 bytes

-join(1..($x=$args.count));-join($x..1)

Try it online!

Takes input via splatting, which on the command-line prompt looks like, e.g., $a=(4,3,2); .\array-to-indices.ps1 @a, and on TIO manifests as separate arguments for each entry.

We take the .count of the input $args, store that into $x. Then construct a range .. from 1 up to $x and -join it into a string. Finally we -join the range the other direction. Those two strings are left on the pipeline and output is implicit.

Python 2, 64 60 bytes

a=''.join(map(str,range(1,-~len(input()))))
print[a,a[::-1]]

Try it online!

-1 with thanks to @KevinCruijssen

-3 with thanks to @DeadPossum

JavaScript (ES6), 43 bytes

Returns an array of 2 strings.

a=>a.map(_=>(a+=++i,b=i+b),i=a=b='')&&[a,b]

Try it online!

Charcoal, 10 bytes

⟦⭆θ⊕κ⮌⭆θ⊕κ

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

  θ    θ    Input array
 ⭆    ⭆     Map over elements and join
    κ    κ  Current index (0-indexed)
   ⊕    ⊕   Increment
     ⮌      Reverse
⟦           Collect into an array

MathGolf, 6 bytes

£╒y_xα

Try it online!

£╒y_xα
£       Length of input array
 ╒      Range from 1 to n
  y     Join
   _x   Duplicate and reverse
     α  Wrap top two elements in array

Java (JDK), 76 bytes

a->{String[]r={"",""};int i=1;for(var x:a){r[1]=i+r[1];r[0]+=i++;}return r;}

Try it online!

05AB1E, 4 bytes

ā‚J

Try it online or verify all test cases.

Explanation:

ā       # List in the range [1, length of (implicit) input-list]
        #  i.e. ["a","e","i","o","u"] → [1,2,3,4,5]
 Â      # Bifurcated (short for Duplicate & Reverse copy)
  ‚     # Pair both list into a single list of lists
        #  i.e. [1,2,3,4,5] and [5,4,3,2,1] → [[1,2,3,4,5],[5,4,3,2,1]]
   J    # Join the individual items of the inner lists together (and output implicitly)
        #  i.e. [[1,2,3,4,5],[5,4,3,2,1]] → ["12345","54321"]

Husk, 6 bytes

S¤,d↔ŀ

Try it online!

Explanation

S¤,d↔ŀ  -- input xs (list)
     ŀ  -- indices [1..length xs]
S   ↔   -- do the following with itself and itself reversed:
 ¤,d    -- | undigits and join as tuple

Jelly, 6 bytes

J,JṚ$Ḍ

Explanation

J      # Converts an array to [1, ...len(arr)]
 ,     # Paired with
  JṚ$  # The same array as before, reversed.
     Ḍ # Convert the digits to integers.

I'm no Jelly master, so likely sub-optimal.

Try it online!