Define number based on a list

dkmathstud shared this question 3 years ago
Answered

Hi,

I am trying to define a number based on the numbers from a list. I have tried different options but I'm pretty stuck.

l1={3,5,9} should be defined as n1=359

l1={1,4,3,9,2} should be n1=14392

and so on...

Any ideas? :-)

Best Answer
photo

Sum(Sequence(l1(k) 10^(Length(l1) - k), k, 1, Length(l1)))

Comments (3)

photo
2

Sum(Sequence(l1(k) 10^(Length(l1) - k), k, 1, Length(l1)))

photo
1

It's perfect mathmagic. Thank you so much!

photo
1

I have the opposite problem. I´d like to put a number into a list as shown below:

p=1110110 into q={1,1,1,0,1,1,0}

Any ideas?

© 2023 International GeoGebra Institute