login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A216983 The integers sieved by 7, 5, 3, and 2. 0
7, 1, 2, 3, 2, 5, 3, 7, 2, 3, 5, 1, 3, 1, 7, 5, 2, 1, 3, 1, 5, 7, 2, 1, 3, 5, 2, 3, 7, 1, 5, 1, 2, 3, 2, 7, 3, 1, 2, 3, 5, 1, 7, 1, 2, 5, 2, 1, 3, 7, 5, 3, 2, 1, 3, 5, 7, 3, 2, 1, 5, 1, 2, 7, 2, 5, 3, 1, 2, 3, 7, 1, 3, 1, 2, 5, 2, 7, 3, 1, 5, 3, 2, 1, 7, 5, 2 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,1

COMMENTS

A number is tested for the following in order - the first test passed determines a(n):

Is n mod 7 == 1? If so, write 7.

Is n mod 5 == 1? If so, write 5.

Is n mod 3 == 1? If so, write 3.

Is n mod 2 == 1? If so, write 2.

Write 1.

Period 210. - Charles R Greathouse IV, Sep 22 2012

An example of an inverted sieve. Usually we would sieve 2, 3, 5, 7 which gives 2, 1, 2, 3, 2, 5, 2, 7, 2, 3, 2, 1. - Jon Perry, Sep 24 2012

LINKS

Table of n, a(n) for n=1..87.

EXAMPLE

4 is not 1 mod 7 or 1 mod 5 but is 1 mod 3, so a(4) = 3.

MATHEMATICA

Table[If[Mod[n, 7] == 1, 7, If[Mod[n, 5] == 1, 5, If[Mod[n, 3] == 1, 3, If[Mod[n, 2] == 1, 2, 1]]]], {n, 100}] (* T. D. Noe, Sep 25 2012 *)

Table[Which[Mod[n, 7]==1, 7, Mod[n, 5]==1, 5, Mod[n, 3]==1, 3, Mod[n, 2]==1, 2, True, 1], {n, 90}] (* Harvey P. Dale, Mar 04 2016 *)

PROG

(JavaScript) for (i=1; i<90; i++)

if (i%7==1) document.write("7, ");

else if (i%5==1) document.write("5, ");

else if (i%3==1) document.write("3, ");

else if (i%2==1) document.write("2, ");

else document.write("1, ");

(c++)

template <typename T> std::string PrintSequnce_A216983(const T &max)

{

  std::string strSeq;

  for(T i = 1; i < max; ++i)

  {

    if (i%7==1) strSeq+="7";

    else if (i%5==1) strSeq+="5";

    else if (i%3==1) strSeq+="3";

    else if (i%2==1) strSeq+="2";

    else strSeq+="1";

    if(i<max-1)

      strSeq+=", ";

   }

   return strSeq;

} // Martin Ettl, Oct 08 2012

CROSSREFS

Sequence in context: A040052 A134898 A176440 * A021588 A224998 A222216

Adjacent sequences:  A216980 A216981 A216982 * A216984 A216985 A216986

KEYWORD

nonn,easy

AUTHOR

Jon Perry, Sep 21 2012

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 22 12:23 EDT 2019. Contains 321421 sequences. (Running on oeis4.)