## Finding the max XOR of two numbers in an interval: can we do better than quadratic?

Suppose we’re given two numbers $l$ and $r$ and that we want to find $\max{(i\oplus j)}$ for $l\le i,\,j\le r$ .

The naïve algorithm simply checks all possible pairs; for instance in ruby we’d have:

def max_xor(l, r)   max = 0    (l..r).each do |i|     (i..r).each do |j|       if (i ^ j > max)         max = i ^ j       end     end   end    max end 

I sense that we can do better than quadratic. Is there a better algorithm for this problem?

## How to show that the product of two binary numbers cannot be determined in $AC^{0}$?

Input $$x = x_{0} … x_{n-1}$$ for determine the xor over n-bits xi it is suffcient to multiply the following two n2-bits binary numbers: $$a = 0^{n-1} \hspace{2mm} x_{n-1} \hspace{2mm} 0^{n-1} \hspace{2mm} x_{n-2} \hspace{2mm} 0^{n-1} \hspace{2mm} … \hspace{2mm} 0^{n-1} \hspace{2mm} x_{1} \hspace{2mm} 0^{n-1} \hspace{2mm} x_{0}$$

$$b = 0^{n-1} \hspace{3mm} 1 \hspace{5mm} 0^{n-1} \hspace{5mm} 1 \hspace{5mm} 0^{n-1} \hspace{2mm} … \hspace{2mm} 0^{n-1} \hspace{5mm} 1 \hspace{5mm} 0^{n-1} \hspace{5mm} 1$$

The product of two binary numbers can be determined in $$AC^{1}$$?

## Could we define the decimal notation of a natural number as an expression of multiplication and addition of single digit numbers?

We recognize that every natural number can be expressed as 10 times a natural number plus a number from 0 to 9. Take any natural number and express it that way in the form $$(10 \times x) + y$$ where $$y$$ is between 0 and 9. Again for $$x$$, express that number that way and keep going until the second term of the expression is 0. This shows that every natural number can be gotten by starting from 0 and repeatedly applying operations each of which is of the form of multiplying by 10 then adding a number from 0 to 9. It seems so intuitive to define the decimal notation of a number by the method of getting it in that way where you start from 0 then multiply by 10 and add the first digit then multiply by 10 and add the second digit and so on. For example, we can define the notation 122 to literally mean $$(10 \times ((10 \times ((10 \times 0) + 1)) + 2)) + 2$$.

I know that’s probably not actually the way it was defined but it turns out to be correct. Since it is correct anyway, maybe it is better to define it that way as an instruction to submit into computers. It’s not that hard to show that that definition agrees with the conventional definition. Some people might have a demand to understand why proven math results such as the statement that long division to get a quotient and remainder works but have so many things to learn and don’t want to bother understanding why that definition agrees with the conventional definition. Despite that, could we still define it that way without creating a problem for those people? They might figure out a proof that long division to get a quotient and remainder works using that definition of decimal notation works and then be like “That’s fine, I accept it only as a proof that long division works using that definition of the decimal notation of a natural number and not as proof that long division works using the conventional definition of the decimal notation of a number.”

Also, could we treat English like Python and and say something means something because we defined it to mean that, and then use Polish notation to describe expressions with symbols we just invented a meaning of? Let’s say we already have a meaning for 0 which is ∅ and can also express the successor operation $$S$$ and the addition operation + in Polish notation so $$2 + S(2 + 2)$$ would be written $$+SS∅S+SS∅SS∅$$. Next we define $$0 = ∅, 1 = S∅, 2 = SS∅, 3 = SSS∅, 4 = SSSS∅, 5 = SSSSS∅, 6 = SSSSSS∅, 7 = SSSSSSS∅, 8 = SSSSSSSS∅, 9 = SSSSSSSSS∅, X = SSSSSSSSSS∅$$. Now, the number 122 can be described in Polish notation as $$+×X+×X+×X∅122$$. If you decide to replace the operations of right addition with left addition of the same number, then the Polish notation is $$+2×X+2×X+1×X∅$$. If you have a Python like program you can then again redefine $$0 = +0×X, 1 = +1×X, 2 = +2×X, 3 = +3×X, 4 = +4×X, 5 = +5×X, 6 = +6×X, 7 = +7×X, 8 = +8×X, 9 = +9×X$$ so now the digits are defined as operations so you can now type in $$221∅$$ to mean 122. Also, $$×2∅8001∅$$ could be the way to write 2 × 1008. Although some people use the symbol ∅ in place of the symbol 0, in this case 0 and ∅ don’t mean the same thing it at all. I originally defined 0 to mean the same thing as ∅, the number zero. Later, I redefined the meaning of all the digits to be operations where as ∅ still kept its original meaning, and the new notation for a natural number does not end until you get to the character ∅ making the multiplication expression unambiguous. Then those picky mathematicians will be satisfied with knowing that computer programs programmed that way can use the following law to compute the quotient and remainder of a division problem of natural numbers using the fact that the quotient and remainder of division of a one number by another number can be determined from the quotient and remainder of the floor function of a tenth of the former by the latter. There might be a lot of them who are picky because other mistakes in computer programs have happened such as the Chess Titans glitch in the YouTube video Windows Vista Chess Titans Castling Bug. They will consider long division of natural numbers to get a quotient and remainder to be entirely a function from ordered pairs of natural numbers to ordered pairs of natural number, and will not accept that as proof of how to compute the quotient as a rational number given in mixed fraction notation.

## Basic calculator that takes 2 numbers and does an operation with them

The code works perfectly fine for me (compiled it in BlueJ and Eclipse) but I was wondering what other more experienced programmers thought of it. I’d specifically like to know if it could be shorter or be made more resource efficient.

    /** * This program is just a simple addition calculator that can use whole numbers or decimals. *  * @author Christopher Goodburn  * @version 6/4/2016 */ import java.util.Scanner; import java.math.*;  public class Calculator { private static final Scanner askScanner = new Scanner(System.in); public static double answer; public static double firstNumber; public static double secondNumber; //makes variables for the whole class  public static void main(String[] args) {     calculator(); }      public static void calculator() {        System.out.println("Basic calculator");     System.out.println("Pick one:");     System.out.println("1. Addition");     System.out.println("2. Subtraction");     System.out.println("3. Multiplication");     System.out.println("4. Division");     int pick = askScanner.nextInt();      if(pick == 1) {         addition();     }     else if(pick == 2) {         subtraction();     }     else if(pick == 3) {         multiplication();     }     else if(pick == 4) {         division();     }     else {         System.out.println("You need to choose 1, 2, 3, or 4");         calculator();     }     askScanner.close(); }      private static double getNumbers() {         System.out.println("First number?");         firstNumber = askScanner.nextDouble();         System.out.println("Second Number?");         secondNumber = askScanner.nextDouble();         return firstNumber;     }      public static void subtraction() {         System.out.println("Subtraction");         getNumbers();         answer = firstNumber - secondNumber;         System.out.println("This is the difference of the two numbers:  " + answer);         calculator();     }      public static void addition() {        System.out.println("Addition");        getNumbers();        answer = firstNumber + secondNumber;        System.out.println("This is the sum of the two numbers:  " + answer);        calculator();     }      public static void multiplication() {         System.out.println("Multiplication");         getNumbers();         answer = firstNumber * secondNumber;         System.out.println("This is the product of the two numbers  " + answer);         calculator();     }      public static void division() {         System.out.println("Division");         getNumbers();         answer = firstNumber / secondNumber;         System.out.println("This is the quotient of the two numbers:    " + answer);         calculator();     }  } 

## Online dealer asks for a photo of my credit card and driver’s license, and also all numbers from my card, is it ok?

I was shopping online and I could not buy the desired item, I could only make a request. After that, I received an email from the dealer:

“If you would like to proceed, please fill out the enclosed authorization form and email it back along with copy/picture of your credit card front and back and driver’s license (all required by the Finance Dpt.). Also please provide the complete street address, telephone and email.”

In this “attached authorization form” (just a .doc file) I have to write all the numbers on my credit card, including billing address and card identification number.

Looks like too much information about me. Is this normal?

## Total of cells formula for numbers as text

I want to total up the numbers of split cells. I have an example as follows:

1234 0000 5678 

each number is in its own cell, I want to total it all up underneath to get 6912,
so 1234 + 0000 + 5678 = 6912 if this makes sense.

## permanently show taksbar numbers

I use the super+number hotkeys a lot to switch windows. I’ve noticed if I hold down super and a number I can see what each applications number is. this question asks for the same thing, but I’m using Ubuntu 18.04.1, so things may have become possible since then. Pictured is what I want to be permanent:

## How much can we trust in mathematical software when working with large numbers, and how much memory it needs to work with these numbers?

For example, I want to evaluate the expression:

$$3^{3^{{3}^{3}}}$$

so I used wolframalpha.com (it’s free, and I don’t own any software), which returned a decimal form of the number above, namely:

$$1.258014290627491317860390698… × 10^{3638334640024}$$

Which is huge. However, for the number below

$$4^{4^{{4}^{4}}}$$

Wolfram can’t return a decimal form, probably because it’s a much larger number and it needs a lot o memory.

Questions: a) How much can we trust that

$$3^{3^{{3}^{3}}} \approx 1.258014290627491317860390698… × 10^{3638334640024}$$

b) how much memory (aproximate) it needs to evaluate

$$3^{3^{{3}^{3}}}$$

and

$$4^{4^{{4}^{4}}}$$

I’m guessin a lot of terabytes and something that a home computer can’t handle. But for the first number, Wolfram can, and the second number, it can’t. How do we even find how much size we need to calculate these numbers?

It would be nice if someone improved the tags

## Why sum of two binary numbers cannot be determined in $NC^0$ but in $AC^0$?

Why sum of two binary numbers cannot be determined in $$NC^0$$ but it can be determined in $$AC^0$$?

## Reference Number, and using them to compare with following float numbers

The project is based on Eye Tracker. Let me brief the idea behind the project to understand my problem better.

I have the hardware of Tobii C eye tracker. This eye tracker will be able to give out coordinates of the X, Y of where I am looking at. But this device is very sensitive. When I look at 1 point, the eye tracker will send out many different data of coordinates but within ± 100 range which I found out. Even though you are staring at 1 point, your eyes keep moving, therefore giving out many data. This many data (float numbers) are then saved in a text file. Now I only need 1 data (X coordinate) which signifies the 1 point I am staring instead of the many data which are within the ± 100 range and move it to a new text file.

I have no idea how I should code to do that.

These are the float numbers in the text file.

200 201 198 202 250 278 310 315 360 389 500 568 579 590 

When I stare at point 1, the data are 200-300, which are within the ± 100 range. I wanna set the 200 as reference point subtracts itself with the next number and check if the resultant value within 100, if it is, remove them. The reference point should keep doing that to the following numbers until it reaches outside the ± 100 range. Once outside the 100 range, now the number is 310, then now this number is the next reference point and do the same and subtract with the following numbers below and check if the resultant value within 100. Once outside the 100 range, the next number is 500, now, that is the new reference point, and do the same. That is my objective. To put it to simpler terms, The reference points should be moved into a new file.

This is my code so far which get the gaze coordinates and stores them in a text file.

 using System;  using System.Collections.Generic;  using System.IO;  using System.Linq;  using System.Text;  using Tobii.Interaction;  namespace ConsoleApp1 {  class Program {      private static void programintro()     {         Console.WriteLine("Press Any Keys To Start");     }     public static void Main(string[] args)     {          programintro();         Console.ReadKey();         double currentX = 0.0;         double currentY = 0.0;         double timeStampCurrent = 0.0;         double diffX = 0.0;         double diffY = 0.0;         int counter = 0;         var host = new Host();         host.EnableConnection();         var gazePointDataStream = host.Streams.CreateGazePointDataStream();         gazePointDataStream.GazePoint((gazePointX, gazePointY, timestamp) =>          {             diffX = gazePointX - currentX;             diffY = gazePointY - currentY;             currentX = gazePointX;             currentY = gazePointY;             timeStampCurrent = timestamp;             if (diffX > 100 || diffX <= -100 || diffY >= 100 || diffY <= -100)             {                 counter++;                 using (StreamWriter writer = new StreamWriter("C: \Users\Student\Desktop\FYP 2019\ConsoleApp1\ConsoleApp1\Data\TextFile1.txt", true))                 {                     writer.WriteLine("Recorded Data " + counter + "\n=================================================================================================================\nX: {0} Y:{1}\nData collected at {2}", currentX, currentY, timeStampCurrent);                     writer.WriteLine("=================================================================================================================");                 }                 Console.WriteLine("Recorded Data " + counter + "\n=================================================================================================================\nX: {0} Y:{1}\nData collected at {2}", currentX, currentY, timeStampCurrent);                 Console.WriteLine("=================================================================================================================");             }         });         //host.DisableConnection();         while (true)         {             if (counter <  10)             {                 continue;             }             else             {                  Environment.Exit(0);              }         } 

Now my Question is how do I code to read the text file and set a reference number and subtracts itself with the next number and check if the resultant value within 100 and have a new reference number if it outside the ± 100 range. Those reference numbers are then stored in a new text file.

If there is a code example, I will create a new programme and store there and test it out first.