This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A359036 #23 Jul 02 2025 22:35:17 %S A359036 1,3,2,9,7,8,5,6,4,14,13,18,11,10,21,81,19,12,17,28,15,26,29,30,49,22, %T A359036 33,20,23,24,37,44,27,35,34,100,31,39,38,42,43,40,41,32,50,51,53,80, %U A359036 25,45,46,63,47,56,57,54,55,62,61,72,59,58,52,729,69,70,71,75 %N A359036 a(1) = 1. Thereafter a(n) is the least unused k distinct from n such that d(k) = d(n), where d is the divisor counting function, A000005. %C A359036 A self-inverse permutation of the natural numbers. %H A359036 Michael De Vlieger, <a href="/A359036/b359036.txt">Table of n, a(n) for n = 1..16384</a> %H A359036 Michael De Vlieger, <a href="/A359036/a359036.png">Scatterplot of a(n)</a>, n = 1..1024, showing primes in red, composite prime powers in gold, squarefree composites in green, products of composite prime powers in magenta, and other numbers in blue. Powerful numbers are labeled unless they are less than 32. %H A359036 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %F A359036 a(a(n)) = n. %F A359036 a(prime(k)^(p-1)) = prime(k-1)^(p-1) for even k and prime p else prime(k+1)^(p-1). - _Michael De Vlieger_, Dec 20 2022 %e A359036 a(16) = 81 because this is the smallest unused k != 16, having the same number (5) of divisors as 16. %t A359036 Block[{a, c, k, t, u, nn}, nn = 68; c[_] = False; a[1] = 1; c[1] = True; u = 2; Do[Set[{k, t}, {u, DivisorSigma[0, n]}]; While[Or[c[k], k == n, t != DivisorSigma[0, k]], k++]; Set[{a[n], c[k]}, {k, True}]; If[k == u, While[c[u], u++]], {n, 2, nn}]; Array[a, nn] ] (* _Michael De Vlieger_, Dec 20 2022 *) %o A359036 (Python) %o A359036 from functools import lru_cache %o A359036 from sympy import divisor_count %o A359036 from itertools import count, islice %o A359036 @lru_cache(maxsize=None) %o A359036 def d(n): return divisor_count(n) %o A359036 def agen(): %o A359036 mink, seen = 2, {1} %o A359036 yield 1 %o A359036 for n in count(2): %o A359036 k = mink %o A359036 while k == n or k in seen or d(k) != d(n): k += 1 %o A359036 while mink in seen: mink += 1 %o A359036 yield k %o A359036 seen.add(k) %o A359036 print(list(islice(agen(), 68))) # _Michael S. Branicky_, Dec 13 2022 %Y A359036 Cf. A000005, A005179, A358820. %K A359036 nonn %O A359036 1,2 %A A359036 _David James Sycamore_, Dec 13 2022 %E A359036 More terms from _Michael S. Branicky_, Dec 13 2022