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-6 of 6 results.

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

A269172 Permutation of natural numbers: a(1) = 1, a(2n) = 2*a(n), a(2n+1) = A250469(a(A269380(2n+1))).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 25, 20, 21, 22, 19, 24, 23, 26, 27, 28, 29, 30, 49, 32, 33, 34, 35, 36, 31, 50, 39, 40, 37, 42, 41, 44, 45, 38, 43, 48, 55, 46, 51, 52, 47, 54, 121, 56, 57, 58, 77, 60, 53, 98, 63, 64, 65, 66, 59, 68, 69, 70, 61, 72, 169, 62, 75, 100, 67, 78, 85, 80, 81
Offset: 1

Views

Author

Antti Karttunen, Mar 03 2016

Keywords

Crossrefs

Inverse: A269171.
Related or similar permutations: A260741, A260742, A269356, A269358, A255422.
Cf. also A269394 (a(3n)/3) and A269396.
Differs from A255408 for the first time at n=38, where a(38) = 50, while A255408(38) = 38.

Formula

a(1) = 1, then after for even n, a(n) = 2*a(n/2), and for odd n, A250469(a(A269380(n))).
a(1) = 1, for n > 1, a(n) = A083221(A260738(n), a(A260739(n))).
As a composition of other permutations:
a(n) = A252755(A269386(n)).
a(n) = A252753(A269388(n)).
Other identities. For all n >= 1:
A000035(a(n)) = A000035(n). [This permutation preserves the parity of n.]
a(A003309(n)) = A008578(n). [Maps Ludic numbers to noncomposites.]

A255421 Permutation of natural numbers: a(1) = 1, a(p_n) = ludic(1+a(n)), a(c_n) = nonludic(a(n)), where p_n = n-th prime, c_n = n-th composite number and ludic = A003309, nonludic = A192607.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 23, 19, 20, 21, 25, 22, 24, 26, 27, 28, 29, 34, 37, 30, 31, 32, 36, 33, 41, 35, 38, 39, 43, 40, 47, 42, 49, 52, 53, 44, 45, 46, 51, 48, 61, 57, 50, 54, 55, 59, 67, 56, 71, 64, 58, 66, 70, 72, 97, 60, 62, 63, 77, 69, 83, 65, 81
Offset: 1

Views

Author

Antti Karttunen, Feb 23 2015

Keywords

Comments

This can be viewed as yet another "entanglement permutation", where two pairs of complementary subsets of natural numbers are interwoven with each other. In this case a complementary pair ludic/nonludic numbers (A003309/A192607) is intertwined with a complementary pair prime/composite numbers (A000040/A002808).

Examples

			When n = 19 = A000040(8) [the eighth prime], we look for the value of a(8), which is 8 [all terms less than 19 are fixed because the beginnings of A003309 and A008578 coincide up to A003309(8) = A008578(8) = 17], and then take the eighth ludic number larger than 1, which is A003309(1+8) = 23, thus a(19) = 23.
When n = 20 = A002808(11) [the eleventh composite], we look for the value of a(11), which is 11 [all terms less than 19 are fixed, see above], and then take the eleventh nonludic number, which is A192607(11) = 19, thus a(20) = 19.
When n = 30 = A002808(19) [the 19th composite], we look for the value of a(19), which is 23 [see above], and then take the 23rd nonludic number, which is A192607(23) = 34, thus a(30) = 34.
		

Crossrefs

Formula

a(1) = 1, and for n > 1, if A010051(n) = 1 [i.e. when n is a prime], a(n) = A003309(1+a(A000720(n))), otherwise a(n) = A192607(a(A065855(n))).
As a composition of other permutations:
a(n) = A237126(A246377(n)).
Other identities.
a(A007097(n)) = A255420(n). [Maps iterates of primes to the iterates of Ludic numbers.]

A257732 Permutation of natural numbers: a(1) = 1, a(lucky(n)) = prime(a(n-1)), a(unlucky(n)) = composite(a(n)), where lucky(n) = n-th lucky number A000959, unlucky(n) = n-th unlucky number A050505, and prime = A000040, composite = A002808.

Original entry on oeis.org

1, 4, 2, 9, 6, 16, 7, 12, 3, 26, 14, 21, 23, 8, 13, 39, 24, 33, 35, 15, 53, 22, 56, 36, 17, 49, 51, 25, 75, 34, 37, 78, 5, 52, 27, 69, 101, 72, 38, 102, 50, 54, 43, 106, 10, 74, 40, 94, 73, 134, 83, 98, 55, 135, 70, 76, 62, 141, 18, 100, 57, 125, 19, 99, 175, 114, 41, 130, 167, 77, 176, 95, 89, 104, 137, 86, 184, 28, 149, 133, 80, 164, 30
Offset: 1

Views

Author

Antti Karttunen, May 06 2015

Keywords

Comments

In other words, a(1) = 1 and for n > 1, if n is the k-th lucky number larger than 1 [i.e., n = A000959(k+1)] then a(n) = nthprime(a(k)), otherwise, when n is the k-th unlucky number [i.e., n = A050505(k)], then a(n) = nthcomposite(a(k)).

Crossrefs

Inverse: A257731.
Related or similar permutations: A246378, A255422, A257725, A257734.
Cf. also A032600, A255553, A255554.

Formula

a(1) = 1; for n > 1: if A145649(n) = 1 [i.e., if n is lucky], then a(n) = A000040(a(A109497(n)-1)), otherwise a(n) = A002808(a(n-A109497(n))).
As a composition of other permutations:
a(n) = A246378(A257725(n)).
a(n) = A255422(A257734(n)).

A255324 Difference between the n-th Ludic number and the n-th noncomposite number: a(n) = A003309(n) - A008578(n).

Original entry on oeis.org

0, 0, 0, 0, 0, 0, 0, 0, 4, 2, 0, 6, 4, 2, 4, 6, 8, 8, 10, 10, 12, 16, 12, 14, 18, 18, 18, 18, 20, 22, 30, 22, 26, 24, 34, 26, 28, 24, 30, 42, 38, 42, 42, 36, 40, 38, 40, 36, 34, 38, 48, 50, 48, 60, 56, 56, 66, 62, 66, 64, 72, 76, 68, 70, 72, 76, 80, 76, 78, 72, 72, 78, 74, 70, 72, 84, 84, 86, 84, 92, 88, 84, 88, 86, 94, 96, 98, 104
Offset: 1

Views

Author

Antti Karttunen, Feb 23 2015

Keywords

Crossrefs

Cf. A255325 (the same terms halved).

Programs

Formula

a(n) = A003309(n) - A008578(n).
a(n) = 2*A255325(n).

A257733 Permutation of natural numbers: a(1) = 1, a(ludic(n)) = lucky(1+a(n-1)), a(nonludic(n)) = unlucky(a(n)), where ludic(n) = n-th ludic number A003309, nonludic(n) = n-th nonludic number A192607 and lucky = A000959, unlucky = A050505.

Original entry on oeis.org

1, 3, 9, 2, 33, 5, 7, 14, 4, 45, 163, 8, 15, 11, 20, 6, 25, 59, 203, 12, 22, 17, 63, 28, 13, 10, 35, 78, 235, 251, 18, 30, 24, 83, 39, 19, 1093, 16, 47, 101, 31, 290, 67, 309, 26, 41, 43, 34, 107, 53, 27, 1283, 87, 23, 61, 128, 42, 354, 88, 376, 21, 36, 55, 57, 46, 137, 115, 70, 38, 1499, 321, 112, 32, 81, 161, 56, 1401, 430, 113, 454, 29, 48, 49
Offset: 1

Views

Author

Antti Karttunen, May 06 2015

Keywords

Crossrefs

Inverse: A257734.
Related or similar permutations: A237427, A255422, A257726, A257731.
Cf. also A256486, A256487.
Differs from A257731 for the first time at n=19, where a(19) = 203, while A257731(19) = 63.

Formula

a(1) = 1; for n > 1: if A192490(n) = 1 [i.e., if n is ludic], then a(n) = A000959(1+a(A192512(n)-1)), otherwise a(n) = A050505(a(A236863(n))).
As a composition of other permutations:
a(n) = A257731(A255422(n)).
a(n) = A257726(A237427(n)).
Showing 1-6 of 6 results.