PowerShell, 49 bytes
param($n)($n|?{$_-ge2*$l;$l=$_}).count-eq$n.count
Takes input $n
then uses a Where-Object
to pull out those elements that are -g
reaterthanore
qual to 2
times the $l
ast element. Those are left on the pipeline, and we set our $l
ast element for the next iteration. We then take the .count
of that collection and make sure it's -eq
ual to the .count
of our input array. That Boolean value is left on the pipeline and output is implicit.
If we don't need to worry about negative numbers, we can use the following instead, thanks to mazzy:
PowerShell, 27 bytes
!($args|?{$_-lt2*$l;$l=$_})
This again takes input $args
, and pulls out those items where they're -l
esst
han 2
times the $l
ast element (i.e., they're not "big enough" to make the doubling sequence). If there are any left, then the Boolean-not surrounding the collection results in False
, otherwise if the collection is empty we get True
. That's left on the pipeline and output is implicit.