5
$\begingroup$

I'm still relatively new here, and I'm not a native speaker. I hope, I don't make any obvious mistakes when asking this question. For instance, I simply had no idea how to title it accurately. I'm sorry. I'm open to suggestions.

I'd like to make the following list: 20, 21, 22, 23 ...

I'd like to print it out on paper, eventually.

I have tried a lot, for instance: Table[HoldForm[2]^n, {n, 0, 10}] or HoldForm[2]^# &[Table[n, {n, 0, 10}]]

which both give me: { 1, 2, 22, 23 } ...

Now, that's a good start, but it's not exactly what I need. I need the first two expressions unevaluated, too (20, 21).

Do you have any ideas?

Kind regards

$\endgroup$
1
  • 5
    $\begingroup$ In addition, maybe Array[HoldForm[2^#]&, 11,0]? $\endgroup$
    – user1066
    Aug 22, 2020 at 18:16

3 Answers 3

6
$\begingroup$

I believe this

Table[HoldForm[2^n]/.n->i,{i,0,4}]

gives you your result in the form you wish

$\endgroup$
7
$\begingroup$

A few additional alternatives:

2^HoldForm /@ Range[0, 4]

enter image description here

Table[With[{i = i}, HoldForm[2^i]], {i, 0, 4}]

enter image description here

$\endgroup$
6
$\begingroup$

Pure function work.

HoldForm[2^#] & /@ Range[0, 10]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.