|
|
A260096
|
|
Numbers whose decimal and hexadecimal representations both have strictly decreasing digits.
|
|
0
|
|
|
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 32, 50, 64, 65, 80, 81, 82, 83, 84, 96, 97, 98, 210, 54320, 54321, 64320, 64321, 65210, 764210
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
|
|
LINKS
|
|
|
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
|
|
|
STATUS
|
approved
|
|
|
|