A043320 Numbers which, written in base 256, have all digits less than 16 and no two adjacent digits equal.
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 256, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 512, 513, 515, 516, 517, 518, 519, 520, 521, 522, 523, 524, 525, 526, 527, 768, 769, 770, 772, 773, 774
Offset: 1
Links
- Vincenzo Librandi, Table of n, a(n) for n = 1..1800
Programs
-
Mathematica
Select[Range[20000], Union[Length/@Split[IntegerDigits[#, 16]]]=={2}&]/17 (* Vincenzo Librandi, Feb 06 2014 *)
-
PARI
is_A043320(n)={(n=[n])&&!until(!n[1], ((n=divrem(n[1], 256))[2]<16 && n[1]%16!=n[2])||return)} \\ M. F. Hasler, Feb 03 2014
-
Python
from itertools import count, islice, groupby def A043320_gen(startvalue=1): # generator of terms >= startvalue return filter(lambda n:set(len(list(g)) for k, g in groupby(hex(17*n)[2:]))=={2},count(max(startvalue,1))) A043320_list = list(islice(A043320_gen(),20)) # Chai Wah Wu, Mar 10 2023
Formula
a(n) = A033014(n)/17. [This was initially the definition of the sequence. - M. F. Hasler, Feb 03 2014]
Extensions
New definition by M. F. Hasler, Feb 03 2014
Comments