Code Monkey home page Code Monkey logo

help-me's Introduction

Help me!

I was working on math task and was not able to solve it :( Please, help me to implement "simple" counter.

function count(s, pairs) {
  return 0; // number
}

As first argument you will take bit mask in string s (can contains only 1 or 0). As second argument you will take array of pairs (array, which contain many arrays with length equal 2). Each pairs[q][0] !== pairs[w][0] and each pairs[h][0] is prime.

Let's define number N

  N = (pairs[0][0] ** pairs[0][1]) *
    (pairs[1][0] ** pairs[1][1]) *
    (pairs[2][0] ** pairs[2][1]) * /*
    ..... */ *
    (pairs[pairs.length - 1][0] ** pairs[pairs.length - 1][1])

Your task is to calculate - how many such integer numbers k exist (0 <= k <= N), which follow next condition: greatest common divisor of (k + j and N) is 1 if s[j] === 1 AND greatest common divisor of (k + j and N) is NOT 1 if s[j] === 0.

Please, return NOT the actual number, but the number which is answer mod 1000000007.

  // ... your solution
  // answer - task solution
  const result = answer % 1000000007;
  return result;

help-me's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.