I have this exercise in mind, I keep trying to solve it in Java but I’m not able to create a correct algorithm to get the submultiples of each number in a range, the start and the end of the range is user defined. Besides, the number 1 doesn’t count as a submultiple. For example, in a range between 3

# Tag: math

## Java Calculator program issue

I am trying to develop a calculator program that inputs an arithmetic expression of the form number operator number = and computes the result of the expression. The expression will be evaluated from left to right not considering regular operator precedence. For example, the expression 14 – 5 * 3 = will produce 27.0. The value = displays the final

## Longest common prefix in binary representation

We are given a undirected tree with N (1 to N) nodes rooted at node 1. Every node has a value assigned with it, represented by array – A[i] where i:[1:N]. We need to answer Q queries of type : -> V X : longest length of the common prefix between value V and any ancestor of node X including

## How to calculate which sector of a circle a given point is with custom sectors?

So I’m making a TD game where I can place a gatling gun, and depending on which sector of a surrounding circle the mouse is in, the sprite and bullet path will change. My difficulty is with creating an algorithm which will tell me which sector my mouse is in. My circle has 16 sectors, and a radius of 300.

## Put sin on segment in 3d

i need to put a sin function, or any other function on start of segment in 3d space. Something like that: Example But in 3d space, help me pls, i spent about 4 days for solving it, but did not get result There are 2 points in space at arbitrary positions. I need a sinusoid between these two arbitrary points.

## Why is my trapezoid rule implementation not producing expected results?

I have implemented a function to find the trapezoid rule of a given function, the function produces poor results for . When I try to calculate the trapezoid rule with n < 8 it produces a value much larger than the actual area, which is unexpected, I have graphed f(x) and drawn how I believe the first few numbers of

## Looking to get the yearly returns on this total compound interest calculator

I’m really new to Java so please excuse if this isn’t the 100% right way to even write this code. So I’ve been messing around with this code for about 6 hours now, and I can not for the life of me figure out how to fix this issue: I have a compound interest calculator that takes user input for

## Bezier curve : forcing a curve of 4 points to pass through control points in 3D space

I have read the thread to make this happen for 4 points but only in 2D space here . I have implemented the answer for 3D but only for 3 control points here I have read this post but don’t understand …

## How to calculate the coordinates of the second point on the map?

Example pictureI have the coordinates of the first point on the map, there is a distance between the points and there are degrees of rotation relative to the cardinal points (from the compass). Please …

## Rounding in Java using Math.random()

Suppose I write System.out.println (Math.random()*5); then one would obtain and output of x in [0, 4.9…]. But upon casting it as an integer, the result I continuously see (in my course) is [0, 4]. …