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.

Showing 1-4 of 4 results.

A125717 a(0)=0; thereafter a(n) = the smallest nonnegative integer not already in the sequence such that a(n-1) is congruent to a(n) (mod n).

Original entry on oeis.org

0, 1, 3, 6, 2, 7, 13, 20, 4, 22, 12, 23, 11, 24, 10, 25, 9, 26, 8, 27, 47, 5, 49, 72, 48, 73, 21, 75, 19, 77, 17, 79, 15, 81, 115, 45, 117, 43, 119, 41, 121, 39, 123, 37, 125, 35, 127, 33, 129, 31, 131, 29, 133, 80, 134, 189, 245, 74, 16, 193, 253, 70, 132, 69, 197, 67, 199, 65
Offset: 0

Views

Author

Leroy Quet, Feb 01 2007

Keywords

Comments

This sequence seems likely to be a permutation of the nonnegative integers.
A245340(n) = smallest m such that a(m) = n, or -1 if n never appears.
See A245394 and A245395 for record values of a(n) and where they occur. - Reinhard Zumkeller, Jul 21 2014
See A370956 and A370959 for record values of the inverse A245340 and where they occur. - N. J. A. Sloane, Apr 29 2024
A very nice (maybe the most natural) variant of Recamán's sequence A005132. - M. F. Hasler, Nov 03 2014

Crossrefs

Cf. A245340 (inverse), A370957 (first differences), A245394 & A245395 (records in this sequence), A370956 & A370959 (records in inverse).
See also A005132 (Recaman), A099506, A125715, A125718, A125725.

Programs

  • Haskell
    import Data.IntMap (singleton, member, (!), insert)
    a125717 n = a125717_list !! n
    a125717_list =  0 : f [1..] 0 (singleton 0 0) where
       f (v:vs) w m = 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 x : f vs x (insert x v m)
    -- Reinhard Zumkeller, Jul 21 2014
    
  • Mathematica
    f[l_List] := Block[{n = Length[l], k = Mod[l[[ -1]], n]},While[MemberQ[l, k], k += n];Append[l, k]];Nest[f, {0}, 70] (* Ray Chandler, Feb 04 2007, updated for change to offset Oct 10 2019 *)
  • PARI
    {Quet_p2(n)=/* Permutation sequence a'la Leroy Quet, A125717 */local(x=[1],k=0,w=1); for(i=2,n,if((k=x[i-1]%i)==0,k=i);while(bittest(w,k-1)>0,k+=i);x=concat(x,k);w+=2^(k-1)); return(x)} \\ Ferenc Adorjan
    
  • PARI
    A125717(n,show=0)={my(u=1,a);for(n=1,n,a%=n;while(bittest(u,a),a+=n);u+=1<M. F. Hasler, Nov 03 2014
    
  • Python
    from itertools import count, islice
    def agen(): # generator of terms
        an, aset = 0, {0}
        for n in count(1):
            yield an
            an = next(m for m in count(an%n, n) if m not in aset)
            aset.add(an)
    print(list(islice(agen(), 70))) # Michael S. Branicky, Jun 07 2023

Extensions

Extended by Ray Chandler, Feb 04 2007
a(0) added by Franklin T. Adams-Watters, Mar 31 2014
Edited by N. J. A. Sloane, Mar 15 2024

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

A245395 Where record values occur in A125717.

Original entry on oeis.org

0, 1, 2, 3, 5, 6, 7, 9, 11, 13, 15, 17, 19, 20, 22, 23, 25, 27, 29, 31, 33, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 55, 56, 60, 83, 106, 107, 111, 115, 148, 157, 161, 165, 169, 172, 173, 186, 192, 250, 256, 258, 264, 268, 272, 276, 280, 284, 287, 289
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 21 2014

Keywords

Comments

A245394(n) = A125717(a(n)) and A125717(m) < A245394(n) for m < a(n).

Crossrefs

Programs

  • Haskell
    a245395 n = a245395_list !! (n-1) -- a245395_list is defined in A245394.

A370956 Record high values in A245340.

Original entry on oeis.org

0, 1, 4, 8, 21, 1518, 2510, 4100, 11181, 18414, 30374, 50121, 82924, 136341, 611212, 4477981, 7351356, 12086260, 19861634, 32648059, 53646155, 144857355, 238062163, 643132294, 1736990151, 4691130396, 7709412048
Offset: 1

Views

Author

N. J. A. Sloane, Mar 13 2024

Keywords

Comments

These numbers take a record number of steps to appear in A125717.

Crossrefs

See A370959 for the indices of these records in A245340.

Programs

  • Python
    from itertools import count, islice
    def A370956_gen(): # generator of terms
        a, aset, b, c = 0, set(), 0, -1
        for n in count(1):
            aset.add(a)
            if a==b:
                if n-1>c:
                    c = n-1
                    yield c
                while b in aset:
                    b += 1
            a = next(a for a in count(a%n,n) if a not in aset)
    A370956_list = list(islice(A370956_gen(),20)) # Chai Wah Wu, Mar 28 2024

Extensions

a(17)-a(24) from Michael S. Branicky, Mar 28 2024
a(25)-a(27) from Chai Wah Wu, Mar 28 2024
Showing 1-4 of 4 results.