The last standing gunman in a circle

I dont know why, In most of the interviews, interviewers are asking this question commonly. The question is : There are n number of persons standing in a circle manner. The first person has a gun and he kills the very next person who is alive and handovers the gun to the next person. Who will remain? Here is my code for the above scenario. It works if anyone needs take it.

public static void void main(String ar[]) {      int numberOfGuys = 10000;     List<Integer> list = new ArrayList<>();     for ( int i = 1; i <= numberOfGuys; i++ ) {         list.add( i );     }     boolean isNeighbour = false;      System.out.println( list );     Iterator<Integer> i = list.iterator();     list = new ArrayList<>();     boolean isTrue = true;     while ( isTrue ) {         int k = i.next();         if ( isNeighbour )             i.remove();         else {             list.add( k );         }         if ( !i.hasNext() ) {             System.out.println( list );             i = list.iterator();             if ( list.size() == 1 )                 isTrue = false;             list = new ArrayList<>();         }         isNeighbour = !isNeighbour;     } } 

Move the onscreen circle when camera moves

I have a script that accesses my webcam and displays the captured video on the screen. I can also very easily draw a circle (a rectangle, it doesn’t matter) over the video.

When I move the camera physically, the video also “moves”. My webcam is armed on the top left corner of my monitor. So when I slide the camera across the monitor to the right, the video itself, and so all obejcts in it move left. But, it’s obvious, that the drawn circle stays unmoved.

Now I want the circle be moved when the camera moves.

G1. When the circle contains an object (as in pic1), the goal can be reached using the object tracking algorithms. (I am working with python and using openCV lib, and there are several builtin algorithms (Boosting, MedianFlow, MIL), also the meanshift algorithm, etc.)

G2. There can be cases, when the circle doesn’t contain an object (doesn’t have any underlying object, as in pic2). In these cases the object tracking algorithms don’t work.

I hope I managed to explain the problem. Now I have 2 questions:

Q1. Is there a better way to achieve the Goal1?

Q2. How can I achieve the Goal2? (Maybe there is a way to determine that the video and objects (the wall watch in pic2) moved left, and move the circle proportionally.)

Any help would be appreciated.

P. S. I’m new to Stack Exchange platform, so if the current topic isn’t the right place for my question (problem), please tell me where should I post it.

Pic1 Pic2

MacBook Air 2013 with circle slash while trying to install Mojave

I’ve always been a Linux and Windows user, but I bought this used MacBook Air to mess with. I figured a fresh install was best for it so I erased the primary drive in disk utility and got a known-working Mojave installer from work to reinstall Mojave. However, I get about 2/3rds of the way to the loading screen before it goes to circle-slash. I reset SMC, PRAM 3-4 times, and also reformatted the SSD to no avail; always hangs on the same step. Anyone know what might be the issue?

Overconcentration of Poles on the Circle of Convergence of a Power Series with Bounded Coefficients

Let $ V$ be an arbitrary set of infinitely many positive integers, and let: $ $ \varsigma_{V}\left(z\right)\overset{\textrm{def}}{=}\sum_{v\in V}z^{v}$ $ Let $ T_{V}$ denote the set of all $ t\in\left[0,1\right)$ for which the limit:

$ $ c_{V}\left(t\right)\overset{\textrm{def}}{=}\lim_{x\uparrow1}\left(1-x\right)\varsigma_{V}\left(e^{2\pi it}x\right)$ $ exists and is non-zero. Is $ T_{V}$ necessarily finite (that is, would an “overconcentration” of radii on which $ \varsigma_{V}\left(z\right)$ grows like $ \frac{1}{1-\left|z\right|}$ as $ z$ tends radially to the unit circle result in a contradiction against the boundedness of $ \varsigma_{V}\left(z\right)$ ‘s power series coefficients)? Or do there exist $ V$ for which $ T_{V}$ is infinite?

Part of the problem is that there is so much literature about the boundary behavior and singularities of power series that trying to find information about something this specific is like looking for the needle in the proverbial haystack. Any assistance would be much appreciated.

Arranging numbers in a circle such that the sums of neighbors and sums of diametric opposites are prime

I need to create a circle with numbers from 1 to n , however it is necessary to respect some rules:

  1. All numbers from 1 to n are used in the circle only once.
  2. The sum of two consecutive numbers is a prime number
  3. The sum of a number with what is diametrically opposite it is also a prime number

So I need to create an algorithm that receives an integer n and determines whether there is a circle of size n, if it exists.

For example:

enter image description here

Program response: 1 6 7 16 15 8 5 12 11 18 13 10 3 4 9 14 17 2

I managed to get the expected result, but I do not know if I made the faster way, or if there is something badly written.

import java.sql.Date; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Vector;  import javax.swing.JOptionPane;  public class QuintoDesafio {      private static int j;     private static int k;      private static Vector primes  = new Vector();      public static void main(String[] args)      {           long start = System.currentTimeMillis();            ArrayList list = new ArrayList();          primes.add( new Integer( 2 ) );         primes.add( new Integer( 3 ) );         primes.add( new Integer( 5 ) );         primes.add( new Integer( 7 ) );         primes.add( new Integer( 11 ) );         primes.add( new Integer( 13 ) );         primes.add( new Integer( 17 ) );         primes.add( new Integer( 19 ) );         primes.add( new Integer( 23 ) );         primes.add( new Integer( 31 ) );         primes.add( new Integer( 37 ) );         primes.add( new Integer( 41 ) );          String n = JOptionPane.showInputDialog( "Input n (even) ");         int ene = Integer.parseInt( n );          for ( int i=1; i <= ene; i++ ) {             list.add( new Integer(i) );         }         exchange(list, 0);          long end  = System.currentTimeMillis();            System.out.println(new SimpleDateFormat("ss.SSS").format(new Date(end - start)));       }      static void exchange(ArrayList arr, int k){         boolean passed = true;           for(int i = k; i < arr.size(); i++){             java.util.Collections.swap(arr, i, k);             exchange(arr, k+1);             java.util.Collections.swap(arr, k, i);         }         if (k == arr.size() -1){             int half = arr.size()/2;              for ( int j=0; j<arr.size(); j++ ) {                 int one = (int) arr.get(j);                 int two;                 if ( j+1 == arr.size() ) {                     two = (int) arr.get(0);                 } else {                     two = (int) arr.get(j+1);                 }                 Integer number_test = new Integer( one+two );                 if ( !primes.contains( number_test )) {                     passed = false;                 }             }              for ( int j=0; j<half; j++ ) {                 int one = (int) arr.get(j);                 int two = (int) arr.get(j+half);                 Integer number_test = new Integer( one+two );                 if ( !primes.contains( number_test )) {                     passed = false;                 }             }             if ( passed ) {                 System.out.println(java.util.Arrays.toString(arr.toArray()));             }         }     } } ``` 

How to convert 1000° in radian in order to find the corresponding point on the trigonometric circle. Is there a general formula to do this?

My “understanding” of the radian concept dates back to a few days.

I’m trying to convert a 1000° angle to radians, and to find the corresponding point on the trigonometric circle.

I’m thinking of this.

(1) How many times do I go aroud the circle from 0 to 2 Pi ( in the positive sense) ?

1000/360 = 2, 77777777778

So : 2 times

I’m left with an angle of O,77777777778 times 360 = 280°

(2) How many radians in 280 °

  • One radian is : 360/(2pi).

  • So : 280° in radians is 280/ [ 360/(2pi) ] = 4,8869…

(3) How many “PiRadians” in 4,8869… radians ?

4,88,69 radians in ” PiRadians” is : 1,55555555556 PiRadians

(4) 1, 55 Pi Radians is not far from 15/10 Pi Radians = 3/2 Pi Radians

So a 1000° angle is approximately an angle of : 3/2 Pi Radians

(5) If I am correct, cos(1000) is not far from 0, since

                 cos ( 3/2 Pi) = 0.  

(6) BUT the calculator tell me that cos(1000) = O,1736…

What did I miss?

Stuck on step of the solution Circle theorems/Triangles

GRAPH In ABC right triangle, $ AC=2+\sqrt3$ and $ BC=3+2\sqrt3$ . Circle goes on point $ C$ and its center is on $ AC$ cathetus, $ C$ Cuts the circle in point $ M$ and it touches $ AB$ hypotenuse at point $ D$ . Find the area of shaded part.

Now my solutions and where I’m stuck at:

I found that $ tg <A=\sqrt3$ which means $ <CAB=60^\circ$ then i used formula $ <CAB=\frac{CD-MD}2$ got to $ {\frown} {CD}=150^\circ$ , $ {\frown} {MD}=30^\circ$ . $ <MOD=30^\circ$ $ <OAD=60^\circ$ , so $ OAD$ is a right triangle.

Then bring in ratios: $ AD=x, AO=2x, OD=\sqrt3$

Now I’m stuck here $ AD=2x-x\sqrt3$ , why? I might be missing some rule here, but the next one also confused me. We use another formula $ AD^2=AM*AC (1)$ , I understand why we need to use this, but the calculation confuses me. $ x^2=(2x-x\sqrt3)(2+\sqrt3)$ I don’t understand how we come to this, I’d guess it should be like this instead $ (2x-x\sqrt3)^2=x(2+\sqrt3)$ cause it fits the formula $ (1)$