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.

Original entry on oeis.org

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, 15, 17, 19, 102, 51, 100, 49, 98, 47, 96, 45, 94, 43, 92, 41, 90, 39, 88, 37, 86, 35, 84, 20, 24, 22, 505, 81, 2510, 79, 166, 77, 296, 75, 501, 73, 162, 71, 498, 69
Offset: 0

Views

Author

Reinhard Zumkeller, Jul 21 2014

Keywords

Comments

Conjecture: a(n) is never -1.

Crossrefs

For RECORDS see A370956 and A370959.

Programs

  • Haskell
    import Data.IntMap (singleton, member, (!), insert)
    a245340 n = a245340_list !! n
    a245340_list = 0 : f [1..] [1..] 0 (singleton 0 0) where
       f us'@(u:us) vs'@(v:vs) w m
         | u `member` m = (m ! u) : f us vs' w m
         | otherwise    = g (reverse[w-v,w-2*v..1] ++ [w+v,w+2*v..]) where
         g (x:xs) = if x `member` m then g xs else f us' vs x $ insert x v m
    
  • Python
    from itertools import count
    def A245340(n):
        a, aset = 0, set()
        for m in count(1):
            if a==n: return m-1
            aset.add(a)
            a = next(a for a in count(a%m,m) if a not in aset) # Chai Wah Wu, Mar 13 2024