# Is it a geometric sequence or not?

## Jelly, 4 bytes

```
Ṣ÷ƝE
```

Try it online!

Thanks to fireflame241 for pointing out a mistake

### How it works

```
Ṣ÷ƝE - Main monadic link, takes an array as input
- e.g A = [2, 8, 4] or A = [2, 6, 14]
Ṣ - Sort [2, 4, 8] [2, 6, 14]
Ɲ - Over overlapping pairs [x, y]... [[2, 4], [4, 8]] [[2, 6], [6, 14]]
÷ - ...divide x by y? [0.5, 0.5] [0.33, 0.43]
E - Is the list all the same? 1 0
```

## J, ^{15} ^{14} 13 bytes

```
1=&#&=2%/\/:~
```

Try it online!

*-1 byte thanks to xash*

*-1 byte thanks to Bubbler*

`1=`

Does one equal...`&#&=`

the length of the uniq of...`2%/\`

the list created by dividing each element by its right neighbor in the input list...`/:~`

sorted.

## APL (Dyalog Unicode), ~~25~~ 19 bytes

```
{~∨/⌈(⊣-⊃)2÷/⍵[⍋⍵]}
```

Try it online!

*-6 bytes thanks to @Adám*

```
⍵[⍋⍵] ⍝ sort ⍵
2÷/ ⍝ Take the quotient of all consecutive pairs
⍝ Check if all are equal:
(⊣-⊃) ⍝ Subtract the first quotient
~∨/⌈ ⍝ Are all 0?
```