OFFSET
1,3
COMMENTS
EXAMPLE
54321 belongs to the sequence because its digits are strictly decreasing and its hexadecimal representation, D431, also has strictly decreasing digits.
976210 doesn't belong to the sequence because, while its decimal digits are strictly decreasing, its hexadecimal representation EE552 is not strictly decreasing.
MATHEMATICA
dec[v_] := 0 > Max@ Differences@ v; Select[ Union[ FromDigits/@ Select[ Flatten[ Permutations/@ Subsets[ Range[0, 9]], 1], dec]], dec@ IntegerDigits[#, 16] &] (* Giovanni Resta, Jul 16 2015 *)
PROG
(Python)
def decreasing(top):
if top==0:
yield []
return
for d in range(top):
if d>0:
yield [d]
for s in decreasing(d):
yield [d]+s
def to_int(s):
t = 0
for d in s:
t = t*10+d
return t
def to_hex(n):
out = []
if n==0:
return [0]
while n:
m = n%16
n = (n-m)//16
out.insert(0, m)
return out
def is_decreasing(h):
m = h[0]
for d in h[1:]:
if d>=m:
return False
m = d
return True
ns = sorted(to_int(s) for s in list(decreasing(10)))
a = [n for n in ns if is_decreasing(to_hex(n))]
CROSSREFS
KEYWORD
nonn,base,fini,full
AUTHOR
Christian Perfect, Jul 16 2015
STATUS
approved