cp's OEIS Frontend

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.

A092401 List of pairs n, 3n, where n is the least unused number so far.

This page as a plain text file.
%I A092401 #27 Feb 16 2025 13:36:37
%S A092401 1,3,2,6,4,12,5,15,7,21,8,24,9,27,10,30,11,33,13,39,14,42,16,48,17,51,
%T A092401 18,54,19,57,20,60,22,66,23,69,25,75,26,78,28,84,29,87,31,93,32,96,34,
%U A092401 102,35,105,36,108,37,111,38,114,40,120,41,123,43,129,44,132,45,135,46
%N A092401 List of pairs n, 3n, where n is the least unused number so far.
%C A092401 A permutation of the natural numbers.
%H A092401 T. D. Noe, <a href="/A092401/b092401.txt">Table of n, a(n) for n=1..1000</a>
%H A092401 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A092401 a(2n-1) = A007417(n), a(2n) = 3*A007417(n).
%t A092401 A007417 = Select[ Range[100], (# // IntegerDigits[#, 3]& // Split // Last // Count[#, 0]& // EvenQ)&]; a[n_] := If[ OddQ[n], A007417[[(n+1)/2]], 3*A007417[[n/2]] ]; Table[a[n], {n, 1, 100}] (* _Jean-François Alcover_, Mar 01 2013, from formula *)
%o A092401 (Haskell)
%o A092401 import Data.List (delete)
%o A092401 a092401 n = a092401_list !! (n-1)
%o A092401 a092401_list = f [1..] where
%o A092401    f (x:xs) = x : x' : f (delete x' xs) where x' = 3*x
%o A092401 -- _Reinhard Zumkeller_, Jan 03 2012
%o A092401 (Python)
%o A092401 from sympy import integer_log
%o A092401 def A092401(n):
%o A092401     def f(x): return (n+1>>1)+x-sum(((m:=x//9**i)-2)//3+(m-1)//3+2 for i in range(integer_log(x,9)[0]+1))
%o A092401     m, k = n+1>>1, f(n+1>>1)
%o A092401     while m != k: m, k = k, f(k)
%o A092401     return m if n&1 else 3*m # _Chai Wah Wu_, Feb 16 2025
%Y A092401 Cf. A036552, A203602 (inverse).
%K A092401 easy,nice,nonn
%O A092401 1,2
%A A092401 _Philippe Deléham_, Mar 22 2004