Given a sequence of integers \$A_1,A_2,A_3 ……A_n\$ , find number triples giving equal xor?

For giving sequence $$A_1,A_2,A_3 ……A_n$$ , find number of triples $$i,j,k$$ such that $$1<=i and $$A_i + A_{i+1} + … A_{j-1} = A_{j} + A_{j+1} ….. A_{k}$$ .Where $$+$$ is bitwise xor operation .

I tried to solve it using dynamic programming somewhat similar to https://www.geeksforgeeks.org/count-number-of-subsets-having-a-particular-xor-value/ , but it’s time complexity if $$O(n*m)$$ , where m is maximum element in the array .Can we do better than $$O(n*n)$$ or $$O(n*m)$$ ?

Pythagorean Triples

this my first post in your site , and I am very glad to join to your site.

I need a help in discovering the other two Pythagorean sides ( a squared + b squared = c squared ) if I only know one of the triple ( a or b ) and also I know that all the triple sides are even numbers? I know this will be a trial an error approach, but what is the best algorithm to try and discover ? All thanks

crystal target triples and linked asm

I’m writing a custom kernel in Crystal and Assembly and haven’t managed to find the right info online (probably don’t know enough to find the right words).

How to link Crystal with Assembly? I’v done this with C/C++ but I don’t use those languages.

How can I implement a custom target triple to compile later projects specifically for my kernel?

Is it possible to use a custom—prelude with my own libraries rather than an empty one and copying them into every program and manually requiring them and if so, how?

*I couldn’t create a “crystal” tag so I used ruby

Create an array consisting of triples of consecutive identical elements

As I am learning programming using C#, I try to solve the following problem, for me it looks a bit difficult, please help:

Create an array consisting of triples of consecutive identical elements.

Below is what I came up with so far:

``using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks;  namespace Array3NumbersApp {     class Program     {         static void Main(string[] args)         {             int n = 99;             int[] buffer = new int[n];             Random rnd = new Random();              for (int i = 2; i < buffer.Length; i++)             {                  if (i % 3 == 0)                 {                     int k = rnd.Next(1, 30);                     buffer[i] = k;                     buffer[i-1] = k;                     buffer[i-2] = k;                 }             }              for (int i = 2; i < buffer.Length; i++)             {                 Console.Write(buffer[i -2 ] + " " + buffer[i-1] + " " + buffer[i] + " ");             }          }     } } ``

Anyone can suggest what am I doing wrong in that program? Results I was getting, for example: 0 29 29 29 29 29 29 29 1 29 1 1 1 1 1 1 1 18 1 18 18 18 18 18 18 18 20 18 20 20 20 20 20 20 20 25 20 25 25 25 … It is not what is expected, right?

Determine all triples $$(m,n,p)$$ of positive rational numbers such that the numbers $$m+1/np, n+1/pm, p+1/mn$$ are integers.