A023086 Numbers k such that k and 2*k are anagrams.
0, 125874, 128574, 142587, 142857, 258714, 258741, 285714, 285741, 412587, 412857, 425871, 428571, 1025874, 1028574, 1042587, 1042857, 1052874, 1054287, 1072854, 1074285, 1078524, 1078542, 1085274, 1085427, 1087254, 1087425, 1087524, 1087542
Offset: 1
References
- Fred Schuh, The Master Book of Mathematical Recreations, Dover, New York, 1968, pp. 31-35.
Links
- David W. Wilson, Table of n, a(n) for n = 1..10001
- Mark Dominus, When do n and 2n have the same digits?
Programs
-
Maple
Res:= 0: for d from 1 to 7 do for n from 10^(d-1)+8 to 5*10^(d-1)-1 by 9 do if sort(convert(n,base,10)) = sort(convert(2*n,base,10)) then Res:= Res, n fi od od: Res; # Robert Israel, Mar 20 2017
-
Mathematica
si[n_] := Sort@ IntegerDigits@ n; Flatten@ {0, Table[ Select[ Range[ 10^e+8, 5*10^e-1, 9], si[#] == si[2 #] &], {e, 6}]} (* Giovanni Resta, Mar 20 2017 *)
-
Python
def ok(n): return sorted(str(n)) == sorted(str(2*n)) print(list(filter(ok, range(1087543)))) # Michael S. Branicky, May 21 2021
-
Python
# use with ok above for larger terms def auptod(maxd): return [0] + list(filter(ok, (n for d in range(2, maxd+1) for n in range(10**(d-1)-1, 5*10**(d-1), 9)))) print(auptod(7)) # Michael S. Branicky, May 22 2021
Comments