Jacob and Vicky play the fun game of multiplication by multiplying an integer p
ID: 663438 • Letter: J
Question
Jacob and Vicky play the fun game of multiplication by multiplying an integer p by one of the numbers 2 to 9. Jacob always starts with p = 1, does his multiplication, then Vicky multiplies the number, then Jacob and so on. The winner is who first reaches p >= n (when n is a number chosen at the beginning of each game n>1). Assuming that both of them play perfectly (i.e. Jacob and Vicky play to win, and follow the perfect strategy to win ). Write a Python function play_fun_game, that consume a positive integer n and produces True if Vicky wins after playing the game according to the explained rules, otherwise the function produces False.
Note: you need to develop the strategy to play this game perfectly. For example:
play_fun_game(17) => True
play_fun_game(35) => False
Explanation / Answer
import javax.swing.*;
import java.util.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
public class HelicopterForm implements MouseListener
{
public static void main (String [] args)
{
HelicopterForm a = new HelicopterForm();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.