OFFSET
1,2
COMMENTS
All numbers k where k - 1 is any power with exponent greater than or equal to 2 and k + 1 is a prime number, or vice versa.
If only perfect powers other than 0 and 1 were allowed, then this sequence would start with 3.
All terms greater than 3 are even and follow or precede an odd power.
LINKS
S. Brunner, Table of n, a(n) for n = 1..1600
EXAMPLE
The first 20 terms with their neighbors:
n k-1 k k+1 | n k-1 k k+1
1 0^2 1 2 | 11 5^3 126 127
2 1^2 2 3 | 12 167 168 13^2
3 2 3 2^2 | 13 223 224 15^2
4 7 8 3^2 | 14 15^2 226 227
5 3^2 10 11 | 15 241 242 3^5
6 23 24 5^2 | 16 359 360 19^2
7 3^3 28 29 | 17 439 440 21^2
8 47 48 7^2 | 18 21^2 442 443
9 79 80 3^4 | 19 727 728 3^6
10 3^4 82 83 | 20 839 840 29^2
PROG
(PARI) isok(k) = (k==1) || (k==2) || (ispower(k-1) && isprime(k+1)) || (isprime(k-1) && ispower(k+1)); \\ Michel Marcus, Nov 18 2019
CROSSREFS
KEYWORD
nonn
AUTHOR
S. Brunner, Nov 17 2019
STATUS
approved