Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6926991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:59:24+00:00 2026-05-27T10:59:24+00:00

Given some list numbers = {2,3,5,7,11,13}; How do I translate this to translatedNumbers =

  • 0

Given some list

numbers = {2,3,5,7,11,13};

How do I translate this to

translatedNumbers = {{1,2},{2,3},{3,5},{4,7},{5,11},{6,13}}

concisely?

I am aware of how to do this using the procedural style of programming as follows:

Module[{lst = {}, numbers = {2, 3, 5, 7, 11, 13}},
  Do[AppendTo[lst, {i, numbers[[i]]}], {i, 1, Length@numbers}]; lst]

But such is fairly verbose for what seems to me to be a simple operation. For example the haskell equivalent of this is

numbers = zip [1..] [2,3,5,7,11,13]

I can’t help but think that there is a more concise way of “indexing” a list of numbers in Mathematica.

Potential Answer

Apparently I’m not allowed to answer my own question after having had a lightbulb go off unless I have 100 “rep”. So I’ll just put my answer here. Let me know if I should do anything differently then I have done.

Well I’m feeling a little silly now after having asked this. For if I treat mathematica lists as a matrix I’m able to transpose them. Thus an answer (perhaps not the best) to my question is as follows:

Transpose[{Range@6, {2, 3, 5, 7, 11, 13}}]

Edited to work for arbitrary input lists, I think something like:

With[{lst={2, 3, 5, 7, 11, 13}},Transpose[{Range@Length@lst,lst}]]

will work. Could I do any better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:59:25+00:00Added an answer on May 27, 2026 at 10:59 am

    One thing to consider is if the transformation will not unpack the data. This is important for large data sets.

    On["Packing"]
    
    numbers = Developer`ToPackedArray@{2, 3, 5, 7, 11, 13};
    

    This will unpack

    MapIndexed[{First[#2], #1} &, numbers]
    

    this will not

    Transpose[{Range[Length[#]], #}] &[numbers]
    
    Off["Packing"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

the question is like this: there is a sorted list of n numbers. Given
Given some typical search form, I can't construct this form action when submitting a
I am sure you have already heard about this problem. Given a list of
Given a list, I would like to apply some set of operations to a
I came across a good question while preparing for some programming interviews. Given a
I had quite a big list of numbers. I needed to apply some operation
I'm looking for a good sorted list for java. Googling around give me some
Given some JS code like that one here: for (var i = 0; i
Given some (English) word that we shall assume is a plural , is it
Given some arbitrary SQL I would like to get the data types of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.