Not too good with maths, hope I understood well. Here is a (very inefficient, so I added a constraint to the max num to give) attempt in bash:
#!/bin/bashdeclare-a numbersarr
numbersarr[0]=1
echo"Array position \"n\""read-r myn
# make sure we are given a number and the number is not too largere="^[0-9]+$"if![[$myn=~ $re]]||[$myn-gt 100 ];then
echo"not a number or number too big">&2;exit 1
fi
arrl=1
while[$arrl-le$myn];do
for i in"${numbersarr[@]}";do
let x=2\*i+1
let y=3\*i+1
numbersarr+=($x$y)done
sorted_unique=($(echo"${numbersarr[@]}" |xargs -n1 | sort-gu | xargs))arrl="${#sorted_unique[@]}"done# declare -p sorted_uniqueecho" >> item in pos ${myn}: "${sorted_unique[$myn]}
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Not too good with maths, hope I understood well. Here is a (very inefficient, so I added a constraint to the max num to give) attempt in bash: