%I #39 Jan 05 2020 13:05:47
%S 1,2,3,8,10,24,28,48,80,82,126,168,224,226,242,360,440,442,728,840,
%T 1088,1090,1224,1368,1522,1848,2026,2208,2400,3024,3250,3374,3720,
%U 3968,4760,5040,5624,5928,6562,6858,7920,8648,9802,10608,11026,11448,12322,13688,13690,14160,14640,15130,16128,17160
%N Numbers between a power and a prime.
%C 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.
%C If only perfect powers other than 0 and 1 were allowed, then this sequence would start with 3.
%C All terms greater than 3 are even and follow or precede an odd power.
%H S. Brunner, <a href="/A329582/b329582.txt">Table of n, a(n) for n = 1..1600</a>
%e The first 20 terms with their neighbors:
%e n k-1 k k+1 | n k-1 k k+1
%e 1 0^2 1 2 | 11 5^3 126 127
%e 2 1^2 2 3 | 12 167 168 13^2
%e 3 2 3 2^2 | 13 223 224 15^2
%e 4 7 8 3^2 | 14 15^2 226 227
%e 5 3^2 10 11 | 15 241 242 3^5
%e 6 23 24 5^2 | 16 359 360 19^2
%e 7 3^3 28 29 | 17 439 440 21^2
%e 8 47 48 7^2 | 18 21^2 442 443
%e 9 79 80 3^4 | 19 727 728 3^6
%e 10 3^4 82 83 | 20 839 840 29^2
%o (PARI) isok(k) = (k==1) || (k==2) || (ispower(k-1) && isprime(k+1)) || (isprime(k-1) && ispower(k+1)); \\ _Michel Marcus_, Nov 18 2019
%Y Cf. A163492, A329595.
%K nonn
%O 1,2
%A _S. Brunner_, Nov 17 2019