OFFSET
1,2
COMMENTS
If 0 or 1 are not counted as powers, then this sequence starts with 28.
All terms other than 1 are even and follow or precede an odd power.
LINKS
S. Brunner, Table of n, a(n) for n = 1..1100
EXAMPLE
The first 20 terms with their neighbors:
n k-1 k k+1 | n k-1 k k+1
1 0^3 1 2 | 11 3^8 6562 6563
2 1^3 2 3 | 12 6857 6858 19^3
3 3^3 28 29 | 13 14639 14640 11^4
4 79 80 3^4 | 14 19681 19682 3^9
5 3^4 82 83 | 15 29^3 24390 24391
6 5^3 126 127 | 16 28559 28560 13^4
7 241 242 3^5 | 17 29789 29790 31^3
8 727 728 3^6 | 18 15^4 50626 50627
9 2399 2400 7^4 | 19 50651 50652 37^3
10 3373 3374 15^3 | 20 3^10 59050 59051
MATHEMATICA
{1, 2}~Join~Flatten@ Map[Which[AllTrue[{#2, #3}, # > 2 &], #1 + {-1, 1}, #2 > 2, #1 - 1, #3 > 2, #1 + 1, True, Nothing] & @@ Prepend[Map[GCD @@ FactorInteger[#][[All, -1]] &, {# - 2, # + 2}], #] &, Prime@ Range[160000]] (* Michael De Vlieger, Dec 27 2019 *)
PROG
(PARI) isok(k) = (k==1) || (k==2) || ((ispower(k-1) >= 3) && isprime(k+1)) || (isprime(k-1) && (ispower(k+1) >= 3)); \\ Michel Marcus, Nov 18 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
S. Brunner, Nov 17 2019
STATUS
approved