%I #32 May 19 2021 13:14:23
%S 4,14,18,27,123,256,3125,6556,6566,46656,823543,16777216,387420489,
%T 10000000000,285311670611,8916100448256,95367431640610,95367431640640,
%U 302875106592253,11112006825558016,437893890380859375,18446744073709551616,827240261886336764177
%N Numbers representable as both b^c - b + c and x^y + x - y, where b, c, x, y are integers greater than 1.
%C A000312 except 1 is a subsequence.
%C Terms that are not in A000312: 14, 18, 123, 6556, 6566, 95367431640610, 95367431640640.
%C From _Chai Wah Wu_, May 18 2021: (Start)
%C Sequence is infinite.
%C If a, b > 1 and b^a+b == 0 mod a+1 then b^c-b+c is a term for c = ab(b^(a-1)+1)/(a+1), y = c/a, x = b^a.
%C If b > 1 and b <> 1 mod 3, then b^(2b(b+1)/3)+b(2b-1)/3 is a term.
%C If b > 2, then b^((b-1)(b^(b-2)+1))-b+(b-1)(b^(b-2)+1) is a term.
%C For a(n) with n > 1, either c>=3 or y>=3. If c=y=2, we get b^2-b+2=x^2+x-2, i.e.(x+b)(x-b+1) = 4.
%C Since x>1 and b>1 the only solution is x=b=2 which corresponds to the term a(1) = 4.
%C This allows for a faster search algorithm by assuming c>=3 and y>=3. The cases c=2 and y>=3 can be dealt with by picking y>=3 and solving for b in the quadratic equation b^2-b+2=x^y+x-y. Similarly for c>=3 and y=2.
%C (End)
%H Chai Wah Wu, <a href="/A251966/b251966.txt">Table of n, a(n) for n = 1..30</a>
%e a(5) = 123 = 2^7 + 2 - 7 = 5^3 - 5 + 3.
%t Clear[b0, c0, x0, y0]; m = 100; max = 2^m; tb = Flatten[Table[b0[bc = b^c - b + c ] = b; c0[bc] = c; bc, {b, 2, m}, {c, 2, m}]]; tx = Flatten[Table[x0[xy = x^y + x - y] = x; y0[xy] = y; xy, {x, 2, m}, {y, 2, m}]]; inter = Intersection[Select[tb, # <= max &], Select[tx, # <= max &]]; Table[Print[n = inter[[k]], " b = ", b0[n], " c = ", c0[n], " x = ", x0[n], " y = ", y0[n]]; n, {k, Length[inter]}] (* _Jean-François Alcover_, Mar 23 2015 *)
%o (Python)
%o TOP = 10000000
%o a = [0]*TOP
%o for y in range(2, TOP//2):
%o if 2**y+2-y>=TOP: break
%o for x in range(2, TOP//2):
%o k = x**y+x-y
%o if k>=TOP: break
%o if k>=0: a[k]=1
%o for y in range(2, TOP//2):
%o if 2**y-2+y>=TOP: break
%o for x in range(2, TOP//2):
%o k = x**y-x+y
%o if k>=TOP: break
%o if k>=0: a[k]|=2
%o print([n for n in range(TOP) if a[n]==3])
%Y Cf. A000312, A255535.
%K nonn
%O 1,1
%A _Alex Ratushnyak_, Mar 21 2015