## equation solving – Reduce[Sin[x]== 0, x]dividing odd and even multiples of Pi

From the Title, I wonder why Mathematica does not automatically provide a simple and simple solution to the problem

``````Reduce(Sin(x) == 0, x)
``````

for which I get the following result:

``````Element(C(1), Integers) && (x == 2*Pi*C(1) || x == Pi + 2*Pi*C(1))
``````

The answer is obviously correct, but it is equivalent to

``````Element(C(1), Integers) && x == Pi*C(1)
``````

Why doesn't Mathematica give this answer, and how can I "simplify" the previous answer to it?

In this case, the combined solution is immediately obvious; however, it becomes less obvious when more parameters are introduced, as in the case of

``````Reduce(Sin((Sqrt(2) L Sqrt(m) Sqrt((ScriptCapitalE)))/(HBar)) == 0 && L > 0 && m > 0 && (HBar) > 0, (ScriptCapitalE))
``````

which comes as a condition of the solution of the Schrödinger equation for a particle in a box, and which should be solved in a much more elegant way

``````Element(C(1), Integers) && C(1) >= 1 && (ScriptCapitalE) == (Pi^2*(HBar)^2*C(1)^2)/(2*L^2*m)
``````

instead of the somewhat ugly combination given by the Reduce function.

Funny enough: Wolfram Alpha SI gives the simplest solution!

## dg differential geometry: almost complex structures in cotangent beams of almost complex multiples

Leave $$M$$ be a smooth collector and $$I: TM a TM$$ An almost complex integrable structure. Then, the cotangent package $$T ^ * M$$ supports a complex canonical structure, which can be constructed from holomorphic graphics in $$M$$.

Yes $$I$$ it is not necessarily integrable, is there always an almost complex structure in $$T ^ * M$$ such that $$T ^ * M a M$$ is it holomorphic? Is it canonical? If not, can we build it using some additional option in $$M$$?

## python – Foerach Multiples lists a single line

I want to make a foreach of two lists but that in each line it tells me I have 5 Oranges, I have 6 Pears, I have 2 Bananas, and I can't find the form and it has to be silly enough to do it but I'm starting with python.

``````items = ('naranjas', 'peras', 'platanos')

nums = (5, 6, 2)

# without indexes
for item in items:
print("Tengo" + str(nums) + str(items))

``````

## Do columns and gutters in an 8-point grid system have to be multiples of 8?

for vertical spacing it makes sense to use 8px increments. However, horizontally it seems impossible to maintain that specific space and make it respond.

## java – How to print multiples of one number but not another?

I still learn loops, how can I get my program to print multiples of 2 but not those of 5? When setting the condition if (num == i% 2 && num == i% 5) obviously shows only those of 5, I tried to subtract that but I didn't get it or I can't find a way to structure it.

``````/*Objetivo: imprimir enteros que sean múltiplos de 2 pero no múltiplo de 5
mayor que 100 y menor que 1000
*/
import java.io.*;
import java.lang.*;
public class Problema3
{
public static void main(String args())
{
int num=0;
for(int i=100;i<=1000;i++)
{
if(num==i%2) //multiplos de 2
{
System.out.println(i);
}
}
}
}
``````

## number theory: find multiples of each element of the matrix in the left secondary matrix. How can I make my algorithm more efficient?

Problem Statement: They give you a matrix / sequence of positive numbers $$a_1, a_2, a_3, cdots, a_n$$ and you need to run `q` queries in the matrix and in each query will take a positive number as input and discover all the multiples of the number in the given matrix and print.

``````Input:
2 4 9 15 21 20
q1 = 2
q2 = 3
q3 = 5

Output:
3
3
2
``````

To solve this problem, I thought of an algorithm that works as explained below:

• Create an array name `freq_data()` whose length will be equal to the maximum element of the matrix, and stores the count of each and every number occurred in the input matrix.
For example:

``````  array() = {2, 4, 9, 15, 21, 20}
max_element = 21
freq_data() = {0,1,0,1,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,1,1}
``````
• Create an array name `multiples()` whose length will also be equal to the maximum element found in the matrix. This matrix will store all multiples of the numbers between $$(1, text {maximum value})$$.

• Initialize the `multiples(0) = (size of arr() - 1)` because each number in the matrix is ​​divisible by 1.

• If the query entered is $$( gt text {maximum value})$$ in the matrix, then the answer will be zero because there will be no element in the matrix that is divisible by `arr(i)` because for the number to be a multiple of another, the number must be equal to or greater than the divisor, that is $$( geq arr (i))$$.

• When creating a `multiples()` I will be able to answer each query in constant time by printing the value in `multiples(q - 1)`.

• Complexity of time: $$O (max times log (max))$$
Spatial Complexity: $$O (max.)$$

Using all these facts, I wrote the code in programming language C as follows:

``````#include
#include
#include
#include
#include

uint32_t* find_all_multiples(uint32_t(),uint32_t,uint32_t);

int main(void) {
uint32_t n,max_val = 0;
printf("Enter the size of the sequencen");
scanf("%"SCNu32,&n);
uint32_t data(n);
printf("Enter the datan");
for(uint32_t i = 0; i < n; ++i) {
scanf("%"SCNu32,&data(i));
assert(data(i) > 0);
if(data(i) > max_val) {
max_val = data(i);
}
}
uint32_t *const multiples = find_all_multiples(data,n,max_val);
uint32_t query;
printf("Enter the number of queriesn");
scanf("%"SCNu32,&query);
while(query--) {
uint32_t num;
scanf("%"SCNu32,&num);
if(num > max_val) {
printf("0n");
} else {
printf("%"PRIu32"n",multiples(num - 1));
}
}
free(multiples);
return 0;
}

uint32_t* find_all_multiples(uint32_t data(),uint32_t n,uint32_t max_val) {
uint32_t *const freq_data = calloc(max_val,sizeof(uint32_t));
for(uint32_t i = 0; i < n; ++i) {
++freq_data(data(i) - 1);
}
uint32_t *const multiples = calloc(max_val,sizeof(uint32_t));
multiples(0) = n - 1;
for(uint32_t i = 2; i <= max_val; ++i) {
for(uint32_t j = i; j <= max_val; (j += i)) {
multiples(i - 1) += freq_data(j - 1);
}
}
for(uint32_t i = 0; i < max_val; ++i) {
printf("%"PRIu32" ",multiples(i));
}
printf("n");
free(freq_data);
return multiples;
}
``````

Now I was wondering what would happen if I changed the question instead of taking user queries, I am now interested in finding each `arr(i)` how many multiples are present in the sub-left matrix with respect to `arr(i)` and I wrote the code to solve this problem too, but I'm curious to know if I can do better.
For example:

``````Input:
arr() = {2 6 3}

Output:
no_of_multiples() = {0,0,1} // For 2 , 6 there are no multiples present but for 3 there is one multiple present i.e. 6
``````

The algorithm I designed is basically based on the previous algorithm, but instead of updating the `freq_data()` at the same time I will first check how many multiples of `arr(i)` is present in the `freq_data()` and after finding all the multiples, I will increase the value in `++freq_data(data(i) - 1)`

You can see the source code below:

``````#include
#include
#include
#include
#include
#include

struct multiples_array {
uint32_t value;
uint32_t no_of_multiples;
};
typedef struct multiples_array multiples_array_t;

void take_input(multiples_array_t *const,uint32_t);
void generate_multiples(multiples_array_t *const,uint32_t);
const uint32_t find_maximum(multiples_array_t *const,uint32_t);

int main(void) {
uint32_t n;
printf("Enter the size of the arrayn");
scanf("%"SCNu32,&n);
assert(n > 0);
multiples_array_t *const data = calloc(n,sizeof(multiples_array_t));
if(data) {
take_input(data,n);
generate_multiples(data,n);
free(data);
} else {
fprintf(stderr,"Memory not allocated to *data pointer!n");
}
return 0;
}

void take_input(multiples_array_t *const data,uint32_t n) {
for(uint32_t i = 0; i < n; ++i) {
scanf("%"SCNu32,&(data(i).value));
data(i).no_of_multiples = 0;
assert((data(i).value) > 0);
}
}

void generate_multiples(multiples_array_t *const data,uint32_t n) {
uint32_t max_val = find_maximum(data,n);
uint32_t *const freq_data = calloc(max_val,sizeof(uint32_t));
if(freq_data) {
for(uint32_t i = 0; i < n; ++i) {
if((data(i).value) > max_val) {
max_val = data(i).value;
}
if(data(i).value == 1) {
data(i).no_of_multiples = i;
}
else if(data(i).value <= max_val) {
for(uint32_t j = 1; ((data(i).value) * j) <= max_val; ++j) {
(data(i).no_of_multiples) += freq_data(((data(i).value) * j) - 1);
}
}
++freq_data((data(i).value) - 1);
}
for(uint32_t i = 0; i < n; ++i) {
printf("%"PRIu32" ",(data(i).no_of_multiples));
}
printf("n");
free(freq_data);
} else {
fprintf(stderr,"Memory not allocated to *freq_data pointer!n");
}
}

const uint32_t find_maximum(multiples_array_t *const data,uint32_t n) {
uint32_t max = 0;
for(uint32_t i = 0; i < n; ++i) {
if((data(i).value) > max) {
max = data(i).value;
}
}
return max;
}
``````

Complexity of time: $$O (n times log (max))$$
Spatial Complexity: $$O (max.)$$

My question is: is there any better algorithm to solve the second part, that is, to find all the multiples of `arr(i)` in the sub-left matrix $$forall i$$?

## Program optimization: maximum number of multiples of A[i] in the matrix where the indices of the multiples must be less than i (i.e. j

given a matrix of size n … we have to find the maximum number of multiples of A (i) in the matrix where the indices of the multiples must be less than i (i.e., j

My approach: – I used brute force to solve this … I used nested loops to solve this … the first loop from the last element and the second loop from the first element to the second last element

I can't optimize it … I need help

## elementary number theory: what to investigate to better understand this problem about the integer multiples of rational ones with denominators as powers of the same cousin?

I am trying to find out if it is given a rational number $$frac {a} {p ^ n}$$ with $$0 if you can always find an integer multiple of the rational $$frac {b} {p ^ m}$$ with $$0 give that $$n <<< m$$ . I know it would be a theory of numbers, but I'm not sure exactly what to look for. I want to know more about $$mathbb {Z} / p mathbb {Z}$$ Y $$mathbb {Z} / p ^ n mathbb {Z}$$, with $$n in mathbb {Z} ^ {+}$$ It will help, but I'm not 100% sure. What should I be reading and looking for?

For clarity, the exact problem is as follows.

Leave $$p$$ be a cousin Given $$x = exp ( frac {a2i pi} {p ^ n})$$ Y $$y = exp ( frac {b2i pi} {p ^ m})$$ with $$n, m, a, b in mathbb {Z} ^ {}$$, ($$n ) Y $$0 Y $$0 . Any whole power of $$and$$ generate $$x$$ Yes $$m$$ it's big enough (but we can't know exactly what $$m$$ is)?

## Euler project: multiples of 3 and 5 c ++

I have implemented the following code for the mentioned topic. The results are incorrect in c ++. the same code works correctly in python why?

``````for (int i = 1; i <1000; i++) {
if (i % three == 0 || i%five==0) {
sum_3 += i;
}

}
``````

## dataset – Import images of multiples of FITS format

I want to import several url images that are inside a .txt but I receive an error, it is not a valid URL file, directory or specification

``````In[1]: = F = Import["/home/hp-pc/Desktop/Fits_3.txt", "Text"]

Outside[1]= {"" https: //dr12.sdss.org/sas/dr12/boss/photoObj/frames/301/
2864/1 / frame-u-002864-1-0011.fits.bz2  "
"https: //dr12.sdss.org/sas/dr12/boss/photoObj/frames/301/2864/1/
frame-g-002864-1-0011.fits.bz2  "
"https: //dr12.sdss.org/sas/dr12/boss/photoObj/frames/301/2864/1/
fram / boss / photoObj / frames / 301/6074/5 /
frame-z-006074-5-0011.fits.bz2  ""}

In[2]: = First[Import[#, "FITS"]]& / @ {F}

During the evaluation of In[2]: = Import :: chtype: First argument "https://dr12.sdss.org/sas/dr12/boss/photoObj/frames/301/2864/1/frame-u-002864-1-0011.fits.bz2"
During the evaluation of In[2]: = First :: normal: a non-atomic expression is expected in position 1 in First[\$Failed].

Outside[2]= {First[\$Failed]}
``````

And I really do not know what the error is.