I want to create an array with 17 elements starting with 1 and other numbers are each twice the value immediately before it.
what I have so far is:
import numpy as np
array = np.zeros(shape=17)
array[0]=1
x = 1
for i in array:
print(x)
x *= 2
print(array)
what I got is:
1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
16384
32768
65536
[1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
and what I want is:
[1.2.4.8.16.32.64.128.256.512.1024.2048.4096.8192.16384.32768.65536]