OFFSET
1,1
COMMENTS
Keith numbers are described in A007629. All powers of 4 appear. However, 2 is the only number of the form 2^n with n odd that appears in the sequence. That's because in negabinary, such numbers are represented as 11 followed by n 0's, and that leads to the sequence 1, 1, 0, ... , 0, 2, 3, 5, 10, 20, 40, 80, 160, ... up to 5(2^(n - 2)), and 5(2^(n - 2)) > 2^(n - 1). (See A020714).
MATHEMATICA
(* First run the program from A039724 to define ToNegaBases *) keithFromListQ[n_Integer, digits_List] := Module[{seq = digits, curr = digits[[-1]], ord = Length[digits]}, While[curr < n, curr = Plus@@Take[seq, -ord]; AppendTo[seq, curr]]; Return[seq[[-1]] == n]]; Select[Range[2, 32768], keithFromListQ[#, IntegerDigits[ToNegaBases[#, 2]]] &]
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Alonso del Arte, Mar 29 2011
EXTENSIONS
a(33)-a(39) from Amiram Eldar, Jan 29 2020
STATUS
approved