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-7 of 7 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

A255127 Ludic array: square array A(row,col), where row n lists the numbers removed at stage n in the sieve which produces Ludic numbers. Array is read by antidiagonals A(1,1), A(1,2), A(2,1), A(1,3), A(2,2), A(3,1), ...

Original entry on oeis.org

2, 4, 3, 6, 9, 5, 8, 15, 19, 7, 10, 21, 35, 31, 11, 12, 27, 49, 59, 55, 13, 14, 33, 65, 85, 103, 73, 17, 16, 39, 79, 113, 151, 133, 101, 23, 18, 45, 95, 137, 203, 197, 187, 145, 25, 20, 51, 109, 163, 251, 263, 281, 271, 167, 29, 22, 57, 125, 191, 299, 325, 367, 403, 311, 205, 37, 24, 63, 139, 217, 343, 385, 461, 523, 457, 371, 253, 41
Offset: 2

Views

Author

Antti Karttunen, Feb 22 2015

Keywords

Comments

The starting offset of the sequence giving the terms of square array is 2. However, we can tacitly assume that a(1) = 1 when the sequence is used as a permutation of natural numbers. However, term 1 itself is out of the array.
The choice of offset = 2 for the terms starting in rows >= 1 is motivated by the desire to have a permutation of the integers n -> a(n) with a(n) = A(A002260(n-1), A004736(n-1)) for n > 1 and a(1) := 1. However, since this sequence is declared as a "table", offset = 2 would mean that the first *row* (not element) has index 2. I think the sequence should have offset = 1 and the permutation of the integers would be n -> a(n-1) with a(0) := 1 (if a(1) = A(1,1) = 2). Or, the sequence could have offset 0, with an additional row 0 of length 1 with the only element a(0) = A(0,1) = 1, the permutation still being n -> a(n-1) if a(n=0, 1, 2, ...) = (1, 2, 4, ...). This would be in line with considering 1 as the first ludic number, and A(n, 1) = A003309(n+1) for n >= 0. - M. F. Hasler, Nov 12 2024

Examples

			The top left corner of the array:
   2,   4,   6,   8,  10,  12,   14,   16,   18,   20,   22,   24,   26
   3,   9,  15,  21,  27,  33,   39,   45,   51,   57,   63,   69,   75
   5,  19,  35,  49,  65,  79,   95,  109,  125,  139,  155,  169,  185
   7,  31,  59,  85, 113, 137,  163,  191,  217,  241,  269,  295,  323
  11,  55, 103, 151, 203, 251,  299,  343,  391,  443,  491,  539,  587
  13,  73, 133, 197, 263, 325,  385,  449,  511,  571,  641,  701,  761
  17, 101, 187, 281, 367, 461,  547,  629,  721,  809,  901,  989, 1079
  23, 145, 271, 403, 523, 655,  781,  911, 1037, 1157, 1289, 1417, 1543
  25, 167, 311, 457, 599, 745,  883, 1033, 1181, 1321, 1469, 1615, 1753
  29, 205, 371, 551, 719, 895, 1073, 1243, 1421, 1591, 1771, 1945, 2117
...
		

Crossrefs

Transpose: A255129.
Inverse: A255128. (When considered as a permutation of natural numbers with a(1) = 1).
Cf. A260738 (index of the row where n occurs), A260739 (of the column).
Main diagonal: A255410.
Column 1: A003309 (without the initial 1). Column 2: A254100.
Row 1: A005843, Row 2: A016945, Row 3: A255413, Row 4: A255414, Row 5: A255415, Row 6: A255416, Row 7: A255417, Row 8: A255418, Row 9: A255419.
A192607 gives all the numbers right of the leftmost column, and A192506 gives the composites among them.
Cf. A272565, A271419, A271420 and permutations A269379, A269380, A269384.
Cf. also related or derived arrays A260717, A257257, A257258 (first differences of rows), A276610 (of columns), A276580.
Analogous arrays for other sieves: A083221, A255551, A255543.
Cf. A376237 (ludic factorials), A377469 (ludic analog of A005867).

Programs

  • Mathematica
    rows = 12; cols = 12; t = Range[2, 3000]; r = {1}; n = 1; While[n <= rows, k = First[t]; AppendTo[r, k]; t0 = t; t = Drop[t, {1, -1, k}]; ro[n++] = Complement[t0, t][[1 ;; cols]]]; A = Array[ro, rows]; Table[ A[[n - k + 1, k]], {n, 1, rows}, {k, n, 1, -1}] // Flatten (* Jean-François Alcover, Mar 14 2016, after Ray Chandler *)
  • Python
    a255127 = lambda n: A255127(A002260(k-1), A004736(k-1))
    def A255127(n, k):
        A = A255127; R = A.rows
        while len(R) <= n or len(R[n]) < min(k, A.P[n]): A255127_extend(2*n)
        return R[n][(k-1) % A.P[n]] + (k-1)//A.P[n] * A.S[n]
    A=A255127; A.rows=[[1],[2],[3]]; A.P=[1]*3; A.S=[0,2,6]; A.limit=30
    def A255127_extend(rMax=9, A=A255127):
        A.limit *= 2; L = [x+5-x%2 for x in range(0, A.limit, 3)]
        for r in range(3, rMax):
            if len(A.P) == r:
                A.P += [ A.P[-1] * (A.rows[-1][0] - 1) ]  # A377469
                A.rows += [[]]; A.S += [ A.S[-1] * L[0] ] # ludic factorials
            if len(R := A.rows[r]) < A.P[r]: # append more terms to this row
                R += L[ L[0]*len(R) : A.S[r] : L[0] ]
            L = [x for i, x in enumerate(L) if i%L[0]] # M. F. Hasler, Nov 17 2024
  • Scheme
    (define (A255127 n) (if (<= n 1) n (A255127bi (A002260 (- n 1)) (A004736 (- n 1)))))
    (define (A255127bi row col) ((rowfun_n_for_A255127 row) col))
    ;; definec-macro memoizes its results:
    (definec (rowfun_n_for_A255127 n) (if (= 1 n) (lambda (n) (+ n n)) (let* ((rowfun_for_remaining (rowfun_n_for_remaining_numbers (- n 1))) (eka (rowfun_for_remaining 0))) (COMPOSE rowfun_for_remaining (lambda (n) (* eka (- n 1)))))))
    (definec (rowfun_n_for_remaining_numbers n) (if (= 1 n) (lambda (n) (+ n n 3)) (let* ((rowfun_for_prevrow (rowfun_n_for_remaining_numbers (- n 1))) (off (rowfun_for_prevrow 0))) (COMPOSE rowfun_for_prevrow (lambda (n) (+ 1 n (floor->exact (/ n (- off 1)))))))))
    

Formula

From M. F. Hasler, Nov 12 2024: (Start)
A(r, c) = A(r, c-P(r)) + S(r) = A(r, ((c-1) mod P(r)) + 1) + floor((c-1)/P(r))*S(r) with periods P = (1, 1, 2, 8, 48, 480, 5760, ...) = A377469, and shifts S = (2, 6, 30, 210, 2310, 30030, 510510) = A376237(2, 3, ...). For example:
A(1, c) = A(1, c-1) + 2 = 2 + (c-1)*2 = 2*c,
A(2, c) = A(2, c-1) + 6 = 3 + (c-1)*6 = 6*c - 3,
A(3, c) = A(3, c-2) + 30 = {5 if c is odd else 19} + floor((c-1)/2)*30 = 15*c - 11 + (c mod 2),
A(4, c) = A(4, c-8) + 210 = A(4, ((c-1) mod 8)+1) + floor((c-1)/8)*210, etc. (End)

A255418 Row 8 of Ludic array A255127.

Original entry on oeis.org

23, 145, 271, 403, 523, 655, 781, 911, 1037, 1157, 1289, 1417, 1543, 1673, 1801, 1927, 2057, 2183, 2305, 2437, 2563, 2693, 2819, 2951, 3071, 3197, 3331, 3457, 3587, 3713, 3841, 3967, 4093, 4223, 4349, 4477, 4603, 4735, 4855, 4987, 5113, 5237, 5369, 5489, 5621, 5747, 5875, 6001
Offset: 1

Views

Author

Antti Karttunen, Feb 22 2015

Keywords

Crossrefs

Row 8 of A255127. See A255417 for row 7 and A255419 for row 9.

Programs

  • PARI
    my(L=vector(3913910, x, 3*x+1+x%2), m(n, k)=2^(n\/k*k)\(2^k-1)); for(i=3, 7, L=vecextract(L, 2^#L-m(#L, L[1])-1)); L255418=vecextract(L, m(#L, L[1]));
    A255418(n, P=92160)=n--\P*11741730 + L255418[n%P+1] \\ M. F. Hasler, Nov 17 2024
    
  • Python
    # S can be decreased if only terms up to a smaller limit are needed.
    def A255418(n, S=11741730, P=92160):
        try: n-=1; return A255418.L[n]
        except IndexError: return A255418.L[n%P] + n//P*S
        except AttributeError: L = [x+5-x%2 for x in range(0, S, 3)]
        while (k:=L[0]) < 23: L = [x for i, x in enumerate(L) if i%k]
        A255418.L = L[::k]; return A255418(n+1) # M. F. Hasler, Nov 17 2024
  • Scheme
    (define (A255418 n) (A255127bi 8 n)) ;; Code for A255127bi given in A255127.
    

Formula

a(n) = a(n-P) + S = a((n-1)%P + 1) + S*floor((n-1)/P) with period P = 92160 = A377469(8) and shift S = 11741730 = A376237(9). - M. F. Hasler, Nov 17 2024

A255419 Row 9 of Ludic array A255127.

Original entry on oeis.org

25, 167, 311, 457, 599, 745, 883, 1033, 1181, 1321, 1469, 1615, 1753, 1903, 2041, 2191, 2339, 2483, 2623, 2773, 2911, 3059, 3211, 3353, 3493, 3637, 3781, 3929, 4067, 4217, 4367, 4507, 4657, 4795, 4937, 5087, 5227, 5377, 5527, 5665, 5813, 5957, 6101, 6241, 6389, 6535, 6683, 6821, 6971, 7111
Offset: 1

Views

Author

Antti Karttunen, Feb 22 2015

Keywords

Comments

This is the first row in A255127 that starts with a composite number.

Crossrefs

Row 9 of A255127. See A255413 - A255418 for rows 3 through 8.

Programs

  • PARI
    my(L=vector(97847750, x, 3*x+1+x%2), m(n, k)=2^(n\/k*k)\(2^k-1)); for(i=3, 8, L=vecextract(L, 2^#L-m(#L, L[1])-1)); L255419=vecextract(L, m(#L, L[1]));
    \\ If only terms up to N < P are needed, the vector L above can be chosen shorter
    A255419(n, P=2027520)=n--\P*293543250 + L255419[n%P+1] \\ M. F. Hasler, Nov 17 2024
    
  • Python
    # if only terms up to a smaller limit S are needed, then S can be decreased
    def A255419(n, S=293543250, P=2027520):
        try: n -= 1; return A255419.L[n]
        except IndexError: return A255419.L[n%P] + n//P*S
        except AttributeError: L = [x+5-x%2 for x in range(0, S, 3)]
        while (k:=L[0]) < 25: L = [x for i, x in enumerate(L) if i%k]
        A255419.L = L[::k]; return A255419(n+1) # M. F. Hasler, Nov 17 2024
  • Scheme
    (define (A255419 n) (A255127bi 9 n)) ;; Code for A255127bi given in A255127.
    

Formula

a(n) = a(n-P) + S = a((n-1)%P + 1) + S*floor((n-1)/P) with period P = 2027520 = A377469(9) and shift S = 293543250 = A376237(10). - M. F. Hasler, Nov 17 2024

A377469 a(n) = (A003309(n)-1)*a(n-1) (n > 1), a(1) = 1, where A003309 are the ludic numbers.

Original entry on oeis.org

1, 1, 2, 8, 48, 480, 5760, 92160, 2027520, 48660480, 1362493440, 49049763840, 1961990553600, 82403603251200, 3790565749555200, 197109418976870400, 11826565138612224000, 780553299148406784000, 54638730940388474880000, 4152543551469524090880000, 340508571220500975452160000
Offset: 1

Views

Author

M. F. Hasler, Nov 13 2024

Keywords

Comments

The analog of A005867 for ludic numbers A003309 instead of primes A000040. Since A003309(9) = 23 > A000040(8) = 19 is the first term that differs in the two sequences (up to offset and initial 1's), this sequence differs from A005867 also from the 9th term on, which is a(9) = (23-1)*92160 = 2027520 instead of A005867(8) = (19-1)*92160 = 1658880.
This sequence gives the (pseudo) period lengths of the rows of the ludic sieve array A255127, in which row r is pseudo-periodic, A255127(r, c) = A255127(r, c-a(r)) + S(r), with the shift S(r) given by the ludic factorials A376237.

Examples

			Since A003309 = (1, 2, 3, 5, 7, 11, 13,17, 23, 25, ...), we get:
a(2) = (2-1)*1 = 1, a(3) = (3-1)*1 = 2, a(4) = (5-1)*2 = 8, a(5) = (7-1)*8 = 48,
a(6) = (11-1)*48 = 480, a(7) = (13-1)*480 = 5760, a(8) = (17-1)*2 = 92160,
a(9) = (23-1)*92160 = 2027520, a(10) = (25-1)*2027520 = 48660480, and so on.
		

Crossrefs

Cf. A003309 (ludic numbers), A255127 (ludic sieve array), A376237 (ludic factorials), A005867 (analog of this sequence for primes), A000040 (the primes).

Programs

Formula

a(n) = A005867(n-1) up to n = 8.

A376236 Ludic Fortunate numbers: a(n) = N(P(n)+1) - P(n), where N(x) = min {L in A003309 | L > x} is the next larger ludic number and P(n) = Prod_{k=1..n} A003309[n].

Original entry on oeis.org

2, 3, 5, 7, 11, 23, 17, 37, 61
Offset: 1

Views

Author

M. F. Hasler, Nov 02 2024

Keywords

Comments

Generalization of Fortunate numbers A005235 to ludic numbers A003309 instead of primes.
Are all terms ludic numbers? Will all ludic numbers > 1 appear in this sequence?

Examples

			The first ludic numbers are A003309 = 1, 2, 3, 5, 7, 11, 13, 17, 23, 25, 29, 37, ...
Their cumulative products are P = 1, 2, 6, 30, 210, 2310, 30030, 510510, 11741730, ...
Up to 510510 they are the same as primorials A002110 because ludic numbers > 1 coincide with the primes up to 17.
The first term of this sequence is a(1) = N(1 + P(1)) - P(1) = N(2) - 1 = 3 - 1 = 2, where we write N(x) for the least A003309(k) > x.
The second term is a(2) = N(1 + P(2)) - P(2) = N(3) - 2 = 5 - 2 = 3.
Then a(3) = N(1 + P(3)) - P(3) = N(7) - 6 = 11 - 6 = 5.
Then a(4) = N(1 + P(4)) - P(4) = N(31) - 30 = 37 - 30 = 7, still as in A005235 (because that sequence also uses the least strictly larger prime).
Then a(5) = N(1 + P(5)) - P(5) = N(211) - 210 = 221 - 210 = 11 (while A005235 has nextprime(211) - 210 = 223 - 210 = 13, where again it does not matter that 211 is a prime).
		

Crossrefs

Cf. A003309 (ludic numbers), A376237 (ludic factorials), A005235 (Fortunate numbers: same idea with primes).

Programs

Extensions

a(9) from Pontus von Brömssen, Nov 03 2024

A372607 Let a(1) = 2, f(n) = a(1)*a(2)*...*a(n-1) for n >= 1 and a(n) = nextludicnumber(f(n)+1) - f(n) for n >= 2, where nextludicnumber(x) is the smallest ludic number > x.

Original entry on oeis.org

2, 3, 5, 7, 11, 23, 13, 25, 17
Offset: 1

Views

Author

Davide Rotondo, May 07 2024

Keywords

Comments

Conjecture: every element is a ludic number.
This is the analog of Buss' conjecture (cf. A067836) for ludic numbers instead of primes, and similar to the idea of ludic Fortunate numbers (A376237) in analogy to the usual Fortunate numbers A005235. - M. F. Hasler, Nov 04 2024

Crossrefs

Cf. A067836, A003309 (ludic numbers), A376237 (ludic Fortunate numbers).

Programs

Showing 1-7 of 7 results.