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.

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

This page as a plain text file.
%I A003312 M2308 #66 Oct 29 2023 01:42:49
%S A003312 3,4,5,7,10,14,20,29,43,64,95,142,212,317,475,712,1067,1600,2399,3598,
%T A003312 5396,8093,12139,18208,27311,40966,61448,92171,138256,207383,311074,
%U A003312 466610,699914,1049870,1574804,2362205,3543307,5314960,7972439,11958658,17937986,26906978
%N A003312 a(1) = 3; for n>0, a(n+1) = a(n) + floor((a(n)-1)/2).
%C A003312 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.
%D A003312 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.
%D A003312 N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
%H A003312 N. J. A. Sloane, <a href="/A003312/b003312.txt">Table of n, a(n) for n = 1..1000</a> (first 500 terms from T. D. Noe)
%H A003312 Popular Computing (Calabasas, CA), <a href="/A003309/a003309.pdf">Sieves: Problem 43</a>, Vol. 2 (No. 13, Apr 1974), pp. 6-7. This is Sieve #5. [Annotated and scanned copy]
%H A003312 H. P. Robinson, C. L. Mallows, & N. J. A. Sloane<a href="/A003312/a003312.pdf">Correspondence, 1975</a>
%H A003312 <a href="/index/Si#sieve">Index entries for sequences generated by sieves</a>
%e A003312 The first few sieving stages are as follows:
%e A003312   3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 ...
%e A003312   3 4 5 X 7 8 X 10 11 XX 13 14 XX 16 17 XX 19 20 ...
%e A003312   3 4 5 X 7 X X 10 11 XX XX 14 XX 16 XX XX 19 20 ...
%e A003312   3 4 5 X 7 X X 10 XX XX XX 14 XX 16 XX XX XX 20 ...
%e A003312   3 4 5 X 7 X X 10 XX XX XX 14 XX XX XX XX XX 20 ...
%p A003312 f:=proc(n) option remember; if n=1 then RETURN(3) fi; f(n-1)+floor( (f(n-1)-1)/2 ); end;
%t A003312 NestList[#+Floor[(#-1)/2]&,3,50]  (* _Harvey P. Dale_, Mar 18 2011 *)
%o A003312 (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
%o A003312 (Haskell)
%o A003312 a003312 n = a003312_list !! (n-1)
%o A003312 a003312_list = sieve [3..] where
%o A003312    sieve :: [Integer] -> [Integer]
%o A003312    sieve (x:xs) = x : (sieve $ xOff xs)
%o A003312    xOff :: [Integer] -> [Integer]
%o A003312    xOff (x:x':_:xs) = x : x': (xOff xs)
%o A003312 -- _Reinhard Zumkeller_, Feb 21 2011
%o A003312 (Python)
%o A003312 l=[0, 3]
%o A003312 for n in range(2, 101):
%o A003312     l.append(l[n - 1] + (l[n - 1] - 1)//2)
%o A003312 print(l[1:]) # _Indranil Ghosh_, Jun 09 2017
%o A003312 (Python)
%o A003312 from itertools import islice
%o A003312 def A003312_gen(): # generator of terms
%o A003312     a = 3
%o A003312     while True:
%o A003312         yield a
%o A003312         a += a-1>>1
%o A003312 A003312_list = list(islice(A003312_gen(),30)) # _Chai Wah Wu_, Sep 21 2022
%Y A003312 Cf. A003309, A003310, A100464, A100562, A006999, A061418, A070885, A003311.
%K A003312 nonn,easy,nice
%O A003312 1,1
%A A003312 _N. J. A. Sloane_
%E A003312 Entry revised by _N. J. A. Sloane_, Dec 01 2004 and May 10 2015