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.

A245340 Smallest m such that A125717(m) = n, or -1 if n never appears.

This page as a plain text file.
%I A245340 #24 Apr 30 2024 16:28:32
%S A245340 0,1,4,2,8,21,3,5,18,16,14,12,10,6,1518,32,58,30,184,28,7,26,9,11,13,
%T A245340 15,17,19,102,51,100,49,98,47,96,45,94,43,92,41,90,39,88,37,86,35,84,
%U A245340 20,24,22,505,81,2510,79,166,77,296,75,501,73,162,71,498,69
%N A245340 Smallest m such that A125717(m) = n, or -1 if n never appears.
%C A245340 Conjecture: a(n) is never -1.
%H A245340 Reinhard Zumkeller, <a href="/A245340/b245340.txt">Table of n, a(n) for n = 0..10000</a>
%H A245340 Ferenc Adorjan, <a href="https://web.archive.org/web/20210629063154/http://web.t-online.hu/fadorjan/l_quet.pdf">Some characteristics of Leroy Quet's permutation sequences</a>
%H A245340 N. J. A. Sloane, <a href="/A125717/a125717.jpg">Log-log plot of A370956 vs A370959</a> (shows terms in A125717 that take the longest to appear).
%o A245340 (Haskell)
%o A245340 import Data.IntMap (singleton, member, (!), insert)
%o A245340 a245340 n = a245340_list !! n
%o A245340 a245340_list = 0 : f [1..] [1..] 0 (singleton 0 0) where
%o A245340    f us'@(u:us) vs'@(v:vs) w m
%o A245340      | u `member` m = (m ! u) : f us vs' w m
%o A245340      | otherwise    = g (reverse[w-v,w-2*v..1] ++ [w+v,w+2*v..]) where
%o A245340      g (x:xs) = if x `member` m then g xs else f us' vs x $ insert x v m
%o A245340 (Python)
%o A245340 from itertools import count
%o A245340 def A245340(n):
%o A245340     a, aset = 0, set()
%o A245340     for m in count(1):
%o A245340         if a==n: return m-1
%o A245340         aset.add(a)
%o A245340         a = next(a for a in count(a%m,m) if a not in aset) # _Chai Wah Wu_, Mar 13 2024
%Y A245340 Cf. A245394, A245395, A057167.
%Y A245340 For RECORDS see A370956 and A370959.
%K A245340 nonn
%O A245340 0,3
%A A245340 _Reinhard Zumkeller_, Jul 21 2014