Brief Electrical Comment First
The circuit as depicted seems sound, but it may be wise to measure the max and min peaks with an oscilloscope or multi-meter to ensure you are within the voltage range of the Atmel chip on the Mega 2560, which is zero Volts to Vcc [1] per Atmel processor's spec sheet [1].
Since Vcc is 5V per the Mega's schematic [2], the safe range you depicted is correct, however you cannot trust the voltage on the mains to stay within IEEE specifications, the p-p secondary Voltage of the adapter to be dead on in proportional relation to the primary, or the resistors to be in the center of their 5% or 10% range of precision. You may wish to add some potentiometers to your circuit to make adjustments.
Now the Math and Software Implementation
Continue to take the i,t (integer, time) sample vector as in the example you referenced. I changed the variable names to be more descriptive from a systems engineering point of view.
int s_in = analogRead(input_pin);
unsigned long microsecs = micros();
The algebraic (not code) relation of the sample to the instantaneous voltage is as follows.
v_in = 5V X s_in / 1024
v_no_offset = v_in - v_offsreallyreallyet
v_offset = 2.5
v_secondary = v_no_offset X (110 KOhms / 10KOhms)
Keep in mind here that the sample is not a p-p measurement. It is an integer representing a Voltage measurement over a very small time range relative to the period of an approximate [3] 60 Hertz sine wave. There is no reason to multiply samples or corresponding Voltages by two for this circuit.
The period of a 60 Hertz sine wave is 16,667 usec, so the difference between your max value and min value for any given 16,667 usec period's worth of samples is your p-p Voltage for that period. You can average those over time to get a less instantaneous p-p Voltage. Before considering p-p or RMS calculations, you must first computing the secondary Voltage corresponding to the integer sample acquired in the analogRead.
Substitution and calculation in mV instead of Volts yields this.
mv_secondary = (5000 X s_in / 1024 - 2500) X (110000 / 10000)
Translating into C, which will be interpreted correctly within an Ino sketch, and using a simplified expression and long integers to achieve reasonable computational speed and accuracy [4] you get this.
int s_in = analogRead(input_pin);
unsigned long microsecs = micros();
unsigned long mv_secondary = 53711L * s_in / 1000 - 27500;
The v,t (secondary Voltage, time) vector is now in the variables mv_secondary and microsecs respectively. Then calculate the delta time and find the product to sum.
unsigned long nano_volt_second = mv_secondary * u_sec_delta;
System Design Considerations
In designing the system, it is often better to delegate the conversion to physical units and the Gaussian approximation of an integral to another part of the system (as in the case of when the embedded program is doing data acquisition but not control) or not do it at all (as in the case when control is in the same board as the data acquisition and the PID parameters superseded the need to translate the integers from readAnalog to physical units altogether).
To achieve the higher loop speed when using USB transfer of the values, one can USB transfer the return values of the analogRead more directly as two byte pairs and perform calculations on the USB peer computer (workstation or other computing hardware). Conversion of integers of any type to strings slows a data acquisition loop down considerably, and should be avoided.
Hardware triggering of the ADC subsystem of the Atmel chip can also increase speed, especially if the analogRead function is bypassed by a lower level implementation of the register reading. At sampling speeds above 200KHz, completely within the capability of the Arduino Due, every usec counts.
Ambiguous Intent Reference to Integration
The summing of products isn't actually integration, which is a symbolic operation, not a calculation. The example reference given does a Gaussian discrete approximation of an integral. The reason for seeking that approximation is not given.
The result of such a calculation would be the product of the time over which the approximation is made and the offset, which would naturally be zero except for any calibration error and low frequency noise in the secondary winding's circuit.
If the intention is to calculate Voltage RMS, there is another real time methodology for that. If you want the average p-p Voltage, there's another (partly described above) for that. If you want to track spikes on the line, then you probably want a circuit with over-Voltage protection and a different algorithm.
Usefulness of Optimized Math
The use of unsigned long for optimization may not be necessary for low frequency applications [5], but any system that needs to meet the Nyquist criterion for audio will require a sample rate where the fixed point simulation may cause a statistically significant number of delays over the time of sampling.
Even if the speed is not needed, exceeding the Niquest criteria permits gaining extra bits of accuracy if windowing is used during data reduction.
References
[1] Atmel 2560 cpu spec sheet @ http://www.atmel.com/Images/Atmel-2549-8-bit-AVR-Microcontroller-ATmega640-1280-1281-2560-2561_datasheet.pdf
[2] Mega 2560 schematic @ https://www.arduino.cc/en/uploads/Main/arduino-mega2560-schematic.pdf
[3] A Voltage waveform from a power grid is rarely if ever a perfect sine wave.
[4] Arduino use of long integer constants as in C/C++ discussion @ https://www.arduino.cc/en/Reference/IntegerConstants
[5] The maximum Δt before the unsigned long product overflows is given by `floor ((2^32 - 1) / (53,711 x 1023 / 1000 - 27,500)) = 156,485 usec, corresponding to a 6.39 Hz sample rate.