login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = A004186(n) mod n.
1

%I #19 Mar 18 2021 08:22:41

%S 0,0,0,0,0,0,0,0,0,0,0,9,5,13,6,13,3,9,15,0,0,0,9,18,2,10,18,26,5,0,0,

%T 0,0,9,18,27,36,7,15,0,0,0,0,0,9,18,27,36,45,0,0,0,0,0,0,9,18,27,36,0,

%U 0,0,0,0,0,0,9,18,27,0,0,0,0,0,0,0,0,9,18

%N a(n) = A004186(n) mod n.

%H Simon Strandgaard, <a href="/A337171/a337171.png">Plot of 1000 terms</a>

%e a(12) = A004186(12) mod 12 = 21 mod 12 = 9,

%e a(13) = A004186(13) mod 13 = 31 mod 13 = 5,

%e a(14) = A004186(14) mod 14 = 41 mod 14 = 13,

%e a(15) = A004186(15) mod 15 = 51 mod 15 = 6,

%e a(16) = A004186(16) mod 16 = 61 mod 16 = 13.

%t a[n_] := Mod[FromDigits @ Sort[IntegerDigits[n], Greater], n]; Array[a, 100] (* _Amiram Eldar_, Jan 30 2021 *)

%o (Ruby) values = (1..20).map do |n|

%o n.to_s.split('').sort.join.reverse.to_i % n

%o end

%o p values

%o (PARI) a(n) = fromdigits(vecsort(digits(n), , 4)) % n; \\ _Michel Marcus_, Mar 04 2021

%Y Cf. A004186.

%Y Cf. A319650 (similar in binary).

%K nonn,base

%O 1,12

%A _Simon Strandgaard_, Jan 28 2021