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

A100585 a(n+1) = a(n)+floor(a(n)/3), a(1) = 3.

Original entry on oeis.org

3, 4, 5, 6, 8, 10, 13, 17, 22, 29, 38, 50, 66, 88, 117, 156, 208, 277, 369, 492, 656, 874, 1165, 1553, 2070, 2760, 3680, 4906, 6541, 8721, 11628, 15504, 20672, 27562, 36749, 48998, 65330, 87106, 116141, 154854, 206472, 275296, 367061, 489414, 652552
Offset: 1

Views

Author

N. J. A. Sloane, Dec 01 2004

Keywords

Comments

Original definition: Write down the numbers from 3 to infinity. Take next number, M say, that has not been crossed off. Counting through the numbers that have not yet been crossed off after that M, cross off every 4th term. Repeat, always crossing off every 4th term of those that remain. The numbers that are left form the sequence.
Can be stated as the number of animals starting from a single trio if any trio of animals can produce a single offspring. See A061418 for the equivalent sequence for pairs of animals. - Luca Khan, Sep 05 2024

Crossrefs

Programs

  • Maple
    R:= 3: x:= 3:
    for i from 2 to 100 do x:= x + floor(x/3); R:= R,x od:
    R; # Robert Israel, Sep 09 2024
  • Mathematica
    t = Range[3, 2500000]; r = {}; While[Length[t] > 0, AppendTo[r, First[t]]; t = Drop[t, {1, -1, 4}];]; r (* Ray Chandler, Dec 02 2004 *)
    NestList[#+Floor[#/3]&,3,50] (* Harvey P. Dale, Jan 14 2019 *)
  • PARI
    a(n,s=3)=for(i=2,n,s+=s\3);s \\ M. F. Hasler, Oct 06 2014

Formula

a(1)=3, a(n+1) = a(n) + floor(a(n)/3). - Ben Paul Thurston, Jan 09 2008

Extensions

More terms from Ray Chandler, Dec 02 2004
Simpler definition from M. F. Hasler, Oct 06 2014

A003310 Generated by a sieve.

Original entry on oeis.org

3, 4, 5, 7, 8, 11, 13, 17, 19, 20, 26, 29, 32, 37, 38, 43, 49, 50, 56, 62, 67, 68, 71, 73, 86, 89, 91, 98, 103, 113, 116, 121, 127, 131, 133, 137, 140, 151, 158, 161, 169, 173, 179, 182, 188, 200, 206, 209, 211, 221, 227, 230, 239, 242, 247, 253, 259, 271, 277, 278
Offset: 1

Views

Author

Keywords

Comments

Apply the sieve of A003309, but begin with 3 rather than 2.

References

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

Crossrefs

Programs

  • Haskell
    a003310 n = a003310_list !! (n-1)
    a003310_list = f [3..] where
       f (x:xs) = x : f (g xs) where
         g zs = us ++ g vs where (us, _:vs) = splitAt (x - 1) zs
    -- Reinhard Zumkeller, Nov 12 2014
  • Mathematica
    t = Range[3, 330]; r = {}; While[Length[t] >0, k = First[t]; AppendTo[r, k]; t = Drop[t, {1, -1, k}];]r (* Ray Chandler, Dec 02 2004 *)

Extensions

More terms from Ray Chandler, Dec 02 2004

A003312 a(1) = 3; for n>0, a(n+1) = a(n) + floor((a(n)-1)/2).

Original entry on oeis.org

3, 4, 5, 7, 10, 14, 20, 29, 43, 64, 95, 142, 212, 317, 475, 712, 1067, 1600, 2399, 3598, 5396, 8093, 12139, 18208, 27311, 40966, 61448, 92171, 138256, 207383, 311074, 466610, 699914, 1049870, 1574804, 2362205, 3543307, 5314960, 7972439, 11958658, 17937986, 26906978
Offset: 1

Views

Author

Keywords

Comments

This sequence was originally defined in Popular Computing in 1974 by a sieve, as follows. Write down the numbers from 3 to infinity. Take next number, M say, that has not been crossed off. Counting through the numbers that have not yet been crossed off after that M, cross off every third term. Repeat, always crossing off every third term of those that remain. The numbers that are left form the sequence. The recurrence given here for the sequence was found by Colin Mallows. The problem asked for the 1000th term, and was unsolved for several years.

Examples

			The first few sieving stages are as follows:
  3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
  3 4 5 X 7 8 X 10 11 XX 13 14 XX 16 17 XX 19 20 ...
  3 4 5 X 7 X X 10 11 XX XX 14 XX 16 XX XX 19 20 ...
  3 4 5 X 7 X X 10 XX XX XX 14 XX 16 XX XX XX 20 ...
  3 4 5 X 7 X X 10 XX XX XX 14 XX XX XX XX XX 20 ...
		

References

  • Popular Computing (Calabasas, CA), Problem 43, Sieves, sieve #5, Vol. 2 (No. 13, Apr 1974), pp. 6-7; Vol. 2 (No. 17, Aug 1974), page 16; Vol. 5 (No. 51, Jun 1977), p. 17.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a003312 n = a003312_list !! (n-1)
    a003312_list = sieve [3..] where
       sieve :: [Integer] -> [Integer]
       sieve (x:xs) = x : (sieve $ xOff xs)
       xOff :: [Integer] -> [Integer]
       xOff (x:x':_:xs) = x : x': (xOff xs)
    -- Reinhard Zumkeller, Feb 21 2011
    
  • Maple
    f:=proc(n) option remember; if n=1 then RETURN(3) fi; f(n-1)+floor( (f(n-1)-1)/2 ); end;
  • Mathematica
    NestList[#+Floor[(#-1)/2]&,3,50]  (* Harvey P. Dale, Mar 18 2011 *)
  • PARI
    v=vector(100); v[1]=3; for(n=2, #v, v[n]=floor((3*v[n-1]-1)/2)); v \\ Clark Kimberling, Dec 30 2010
    
  • Python
    l=[0, 3]
    for n in range(2, 101):
        l.append(l[n - 1] + (l[n - 1] - 1)//2)
    print(l[1:]) # Indranil Ghosh, Jun 09 2017
    
  • Python
    from itertools import islice
    def A003312_gen(): # generator of terms
        a = 3
        while True:
            yield a
            a += a-1>>1
    A003312_list = list(islice(A003312_gen(),30)) # Chai Wah Wu, Sep 21 2022

Extensions

Entry revised by N. J. A. Sloane, Dec 01 2004 and May 10 2015

A003311 Write down the numbers from 3 to infinity. Take next number, M say, that has not been crossed off. Counting through the numbers that have not yet been crossed off after that M, cross off the first, (M+1)st, (2M+1)st, (3M+1)st, etc. Repeat. The numbers that are left form the sequence.

Original entry on oeis.org

3, 5, 8, 11, 15, 18, 23, 27, 32, 38, 42, 47, 53, 57, 63, 71, 75, 78, 90, 93, 98, 105, 113, 117, 123, 132, 137, 140, 147, 161, 165, 168, 176, 183, 188, 197, 206, 212, 215, 227, 233, 237, 243, 252, 258, 267, 278, 282, 287, 293, 303, 312, 317, 323
Offset: 1

Views

Author

Keywords

Examples

			The first few sieving stages are as follows:
  3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
  3 X 5 6 X 8 9 XX 11 12 XX 14 15 XX 17 18 XX 20 ...
  3 X 5 X X 8 9 XX 11 12 XX XX 15 XX 17 18 XX 20 ...
  3 X 5 X X 8 X XX 11 12 XX XX 15 XX 17 18 XX 20 ...
  3 X 5 X X 8 X XX 11 XX XX XX 15 XX 17 18 XX 20 ...
  3 X 5 X X 8 X XX 11 XX XX XX 15 XX XX 18 XX 20 ...
		

References

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

Crossrefs

Programs

  • Haskell
    a003311 n = a003311_list !! (n-1)
    a003311_list = f [3..] where
       f (x:xs) = x : f (g xs) where
         g zs = us ++ g vs where (_:us, vs) = splitAt x zs
    -- Reinhard Zumkeller, Nov 12 2014

Extensions

Entry revised Nov 29 2004

A100562 Write down the numbers from 7 to infinity. Take next number, M say, that has not been crossed off and cross off all the numbers i*M - 1 for i >= 2. Repeat. The numbers that are left form the sequence.

Original entry on oeis.org

7, 8, 9, 10, 11, 12, 14, 16, 18, 22, 24, 25, 28, 30, 33, 36, 37, 38, 40, 42, 45, 46, 50, 51, 52, 56, 57, 58, 60, 61, 64, 66, 67, 68, 70, 72, 77, 78, 81, 82, 84, 85, 86, 88, 92, 93, 94, 96, 100, 102, 105, 106, 108, 112, 114, 117, 122, 123, 126, 128, 130, 136
Offset: 1

Views

Author

N. J. A. Sloane, Nov 23 2004

Keywords

Crossrefs

A100586 Write down the numbers from 3 to infinity. Take next number, M say, that has not been crossed off. Counting through the numbers that have not yet been crossed off after that M, cross off every 5th term. Repeat, always crossing off every 5th term of those that remain. The numbers that are left form the sequence.

Original entry on oeis.org

3, 4, 5, 6, 7, 9, 11, 14, 17, 21, 26, 32, 40, 50, 62, 77, 96, 120, 150, 187, 234, 292, 365, 456, 570, 712, 890, 1112, 1390, 1737, 2171, 2714, 3392, 4240, 5300, 6625, 8281, 10351, 12939, 16174, 20217, 25271, 31589, 39486, 49357, 61696, 77120
Offset: 1

Views

Author

N. J. A. Sloane, Dec 01 2004

Keywords

Crossrefs

Programs

  • Mathematica
    t = Range[3, 80000]; r = {}; While[Length[t] > 0, AppendTo[r, First[t]]; t = Drop[t, {1, -1, 5}];]; r (* Ray Chandler, Dec 02 2004 *)

A262231 First term is 2; each subsequent term is the least number greater than the previous term but not a multiple of the successor of any previous term.

Original entry on oeis.org

2, 4, 7, 11, 13, 17, 19, 22, 26, 29, 31, 34, 37, 41, 43, 47, 49, 52, 58, 61, 67, 71, 73, 77, 79, 82, 86, 89, 91, 94, 97, 101, 103, 107, 109, 113, 116, 119, 121, 127, 131, 133, 137, 139, 142, 146, 149, 151, 157, 163, 167, 169, 172, 178, 181, 187, 191
Offset: 1

Views

Author

Drake Thomas, Sep 15 2015

Keywords

Comments

If the twin prime conjecture is true, this sequence has infinitely many pairs of terms with difference at most 3.

Examples

			25 is excluded because it is a multiple of 4+1; 26 is not a multiple of 3,5,8,...,23 so it remains in the sequence.
		

Crossrefs

Cf. A100464.

Programs

  • PARI
    has(n)=fordiv(n,d, if(mapisdefined(m, d-1), return(0))); 1
    first(n)=local(m=Map(Mat([2,0]))); my(t=3); while(#mCharles R Greathouse IV, Sep 16 2015

Formula

a(n) = A100464(n) - 1.
Showing 1-8 of 8 results.