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.

A237058 Inverse permutation to A237056.

Original entry on oeis.org

1, 3, 5, 2, 7, 4, 9, 6, 8, 10, 11, 12, 13, 14, 16, 18, 15, 20, 22, 24, 26, 28, 17, 30, 19, 32, 34, 36, 21, 38, 40, 42, 44, 46, 48, 50, 23, 52, 54, 56, 25, 58, 27, 60, 62, 64, 29, 66, 68, 70, 72, 74, 31, 76, 78, 80, 82, 84, 86, 88, 33, 90, 92, 94, 96, 98, 35
Offset: 1

Views

Author

Keywords

Programs

  • Haskell
    import Data.List (elemIndex); import Data.Maybe (fromJust)
    a237058 = (+ 1) . fromJust . (`elemIndex` a237056_list)

A003309 Ludic numbers: apply the same sieve as Eratosthenes, but cross off every k-th remaining number.

Original entry on oeis.org

1, 2, 3, 5, 7, 11, 13, 17, 23, 25, 29, 37, 41, 43, 47, 53, 61, 67, 71, 77, 83, 89, 91, 97, 107, 115, 119, 121, 127, 131, 143, 149, 157, 161, 173, 175, 179, 181, 193, 209, 211, 221, 223, 227, 233, 235, 239, 247, 257, 265, 277, 283, 287, 301, 307, 313
Offset: 1

Views

Author

Keywords

Comments

The definition can obviously only be applied from k = a(2) = 2 on: for k = 1, all remaining numbers would be deleted. - M. F. Hasler, Nov 02 2024

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Without the initial 1 occurs as the leftmost column in arrays A255127 and A260717.
Cf. A003310, A003311, A100464, A100585, A100586 (variants).
Cf. A192503 (primes in sequence), A192504 (nonprimes), A192512 (number of terms <= n).
Cf. A192490 (characteristic function).
Cf. A192607 (complement).
Cf. A260723 (first differences).
Cf. A255420 (iterates of f(n) = A003309(n+1) starting from n=1).
Subsequence of A302036.
Cf. A237056, A237126, A237427, A235491, A255407, A255408, A255421, A255422, A260435, A260436, A260741, A260742 (permutations constructed from Ludic numbers).
Cf. also A000959, A008578, A255324, A254100, A272565 (Ludic factor of n), A297158, A302032, A302038.
Cf. A376237 (ludic factorial: cumulative product), A376236 (ludic Fortunate numbers).

Programs

  • Haskell
    a003309 n = a003309_list !! (n - 1)
    a003309_list = 1 : f [2..] :: [Int]
       where f (x:xs) = x : f (map snd [(u, v) | (u, v) <- zip [1..] xs,
                                                 mod u x > 0])
    -- Reinhard Zumkeller, Feb 10 2014, Jul 03 2011
    
  • Maple
    ludic:= proc(N) local i, k,S,R;
      S:= {$2..N};
      R:= 1;
      while nops(S) > 0 do
        k:= S[1];
        R:= R,k;
        S:= subsop(seq(1+k*j=NULL, j=0..floor((nops(S)-1)/k)),S);
      od:
    [R];
    end proc:
    ludic(1000); # Robert Israel, Feb 23 2015
  • Mathematica
    t = Range[2, 400]; r = {1}; While[Length[t] > 0, k = First[t]; AppendTo[r, k]; t = Drop[t, {1, -1, k}];]; r (* Ray Chandler, Dec 02 2004 *)
  • PARI
    t=vector(399,x,x+1); r=[1]; while(length(t)>0, k=t[1];r=concat(r,[k]);t=vector((length(t)*(k-1))\k,x,t[(x*k+k-2)\(k-1)])); r \\ Phil Carmody, Feb 07 2007
    
  • PARI
    A3309=[1]; next_A003309(n)=nn && break); n+!if(n=setsearch(A3309,n+1,1),return(A3309[n])) \\ Should be made more efficient if n >> max(A3309). - M. F. Hasler, Nov 02 2024
    {A003309(n) = while(n>#A3309, next_A003309(A3309[#A3309])); A3309[n]} \\ Should be made more efficient in case n >> #A3309. - M. F. Hasler, Nov 03 2024
    
  • PARI
    upto(nn)= my(r=List([1..nn]), p=1); while(p++<#r, my(k=r[p], i=p); while((i+=k)<=#r, listpop(~r, i); i--)); Vec(r); \\ Ruud H.G. van Tol, Dec 13 2024
    
  • Python
    remainders = [0]
    ludics = [2]
    N_MAX = 313
    for i in range(3, N_MAX) :
        ludic_index = 0
        while ludic_index < len(ludics) :
            ludic = ludics[ludic_index]
            remainder = remainders[ludic_index]
            remainders[ludic_index] = (remainder + 1) % ludic
            if remainders[ludic_index] == 0 :
                break
            ludic_index += 1
        if ludic_index == len(ludics) :
            remainders.append(0)
            ludics.append(i)
    ludics = [1] + ludics
    print(ludics)
    # Alexandre Herrera, Aug 10 2023
    
  • Python
    def A003309(): # generator of the infinite list of ludic numbers
        L = [2, 3]; yield 1; yield 2; yield 3
        while k := len(L)//2: # could take min{k | k >= L[-1-k]-1}
            for j in L[-1-k::-1]: k += 1 + k//(j-1)
            L.append(k+2); yield k+2
    A003309_upto = lambda N=99: [t for t,_ in zip(A003309(),range(N))]
    # M. F. Hasler, Nov 02 2024
  • Scheme
    (define (A003309 n) (if (= 1 n) n (A255127bi (- n 1) 1))) ;; Code for A255127bi given in A255127.
    ;; Antti Karttunen, Feb 23 2015
    

Formula

Complement of A192607; A192490(a(n)) = 1. - Reinhard Zumkeller, Jul 05 2011
From Antti Karttunen, Feb 23 2015: (Start)
a(n) = A255407(A008578(n)).
a(n) = A008578(n) + A255324(n).
(End)

Extensions

More terms from David Applegate and N. J. A. Sloane, Nov 23 2004

A237126 a(0)=0, a(1) = 1, a(2n) = nonludic(a(n)), a(2n+1) = ludic(a(n)+1), where ludic = A003309, nonludic = A192607.

Original entry on oeis.org

0, 1, 4, 2, 9, 7, 6, 3, 16, 25, 14, 17, 12, 13, 8, 5, 26, 61, 36, 115, 22, 47, 27, 67, 20, 41, 21, 43, 15, 23, 10, 11, 38, 119, 81, 359, 51, 179, 146, 791, 33, 91, 64, 247, 39, 121, 88, 407, 31, 83, 57, 221, 32, 89, 59, 227, 24, 53, 34, 97, 18, 29, 19, 37, 54
Offset: 0

Views

Author

Keywords

Comments

Shares with permutation A237056 the property that the other bisection consists of only ludic numbers and the other bisection of only nonludic numbers. However, instead of placing terms in those subsets in monotone order this sequence recursively permutes the order of both subsets with the emerging permutation itself, so this is a kind of "deep" variant of A237056.
Alternatively, this can be viewed as yet another "entanglement permutation", where two pairs of complementary subsets of natural numbers are entangled with each other. In this case a complementary pair odd/even numbers (A005408/A005843) is entangled with a complementary pair ludic/nonludic numbers (A003309/A192607).

Examples

			a(2) = a(2*1) = nonludic(a(1)) = A192607(1) = 4.
a(3) = a(2*1+1) = ludic(a(1)+1) = A003309(1+1) = A003309(2) = 2.
a(4) = a(2*2) = nonludic(a(2)) = A192607(4) = 9.
a(5) = a(2*2+1) = ludic(a(2)+1) = A003309(4+1) = A003309(5) = 7.
		

Crossrefs

Cf. A237427 (inverse), A237056, A235491.
Similarly constructed permutations: A227413/A135141.

Programs

  • Haskell
    import Data.List (transpose)
    a237126 n = a237126_list !! n
    a237126_list = 0 : es where
       es = 1 : concat (transpose [map a192607 es, map (a003309 . (+ 1)) es])
    -- Reinhard Zumkeller, Feb 10 2014, Feb 06 2014
    
  • Mathematica
    nmax = 64;
    T = Range[2, 20 nmax];
    L = {1};
    While[Length[T] > 0, With[{k = First[T]},
         AppendTo[L, k]; T = Drop[T, {1, -1, k}]]];
    nonL = Complement[Range[Last[L]], L];
    a[n_] := a[n] = Which[
         n < 2, n,
         EvenQ[n] && a[n/2] <= Length[nonL], nonL[[a[n/2]]],
         OddQ[n] && a[(n-1)/2]+1 <= Length[L], L[[a[(n-1)/2]+1]],
         True, Print[" error: n = ", n, " size of T should be increased"]];
    Table[a[n], {n, 0, nmax}] (* Jean-François Alcover, Oct 10 2021, after Ray Chandler in A003309 *)
  • Scheme
    ;; With Antti Karttunen's IntSeq-library for memoizing definec-macro.
    (definec (A237126 n) (cond ((< n 2) n) ((even? n) (A192607 (A237126 (/ n 2)))) (else (A003309 (+ 1 (A237126 (/ (- n 1) 2))))))) ;; Antti Karttunen, Feb 07 2014

Formula

a(0)=0, a(1) = 1, a(2n) = nonludic(a(n)), a(2n+1) = ludic(a(n)+1), where ludic = A003309, nonludic = A192607.

A088610 Starting with n = 1, a(n) is the smallest squarefree number not included earlier if n is odd, else n is the smallest nonsquarefree number.

Original entry on oeis.org

1, 4, 2, 8, 3, 9, 5, 12, 6, 16, 7, 18, 10, 20, 11, 24, 13, 25, 14, 27, 15, 28, 17, 32, 19, 36, 21, 40, 22, 44, 23, 45, 26, 48, 29, 49, 30, 50, 31, 52, 33, 54, 34, 56, 35, 60, 37, 63, 38, 64, 39, 68, 41, 72, 42, 75, 43, 76, 46, 80, 47, 81, 51, 84, 53, 88, 55, 90, 57, 92, 58, 96
Offset: 1

Views

Author

Amarnath Murthy, Oct 16 2003

Keywords

Comments

From Antti Karttunen, Jun 04 2014: (Start)
Squarefree (A005117) and nonsquarefree numbers (A013929) interleaved, the former at odd n and the latter at even n.
A243344 is a a "recursivized" variant of this permutation. Like this one, it also satisfies the given simple identity linking the parity of n with the Moebius mu-function. (End)

Crossrefs

Inverse: A243352.
Bisections: A005117, A013929.

Programs

  • Mathematica
    With[{max = 100}, s = Select[Range[max], SquareFreeQ]; ns = Complement[Range[max], s]; Riffle[s[[1 ;; Length[ns]]], ns]] (* Amiram Eldar, Mar 04 2024 *)
  • Scheme
    (define (A088610 n) (if (even? n) (A013929 (/ n 2)) (A005117 (/ (+ 1 n) 2))))

Formula

From Antti Karttunen, Jun 04 2014: (Start)
a(2n) = A013929(n), a(2n-1) = A005117(n).
For all n, A008966(a(n)) = A000035(n), or equally, mu(a(n)) = n modulo 2, where mu is Moebius mu (A008683). (End)

Extensions

More terms from Ray Chandler, Oct 18 2003
Showing 1-4 of 4 results.