analogRead gives 1023 regardless of voltage applied

I am trying to use the Arduino Mega 2560 to read feedback from a sensor. Right now I am not using the sensor though, I am just applying a test voltage to analog input A8. To generate the voltage I am jumping from 5V to a breadboard, going through a resistor, and then connecting with a wire back to A8. My resistor values are 220 kOhms and 4.7 MOhms, which generate voltages of 4.04 V and 0.86 V respectively (as measured with a voltmeter). However, when using analogRead, I am getting a value of 1023 (5 Volts) regardless of which resistor I use. The only time I get a different value is when I connect A8 directly to ground, in which case analogRead gives 0. The breadboard is grounded to the Arduino. I have also tried analog input A0 with the same results. If anyone has suggestions for what I am doing wrong, I would greatly appreciate it! Thank you.

Here is the code I am using:

/*
  ReadAnalogVoltage
  Reads an analog input on pin 8, converts it to voltage, and prints the result to the serial monitor.
   
 This example code is in the public domain.
 */

// 
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  if (Serial.available() > 0) {
    int b = Serial.read();
  // read the input on analog pin 0:
  int sensorValue = analogRead(A8);
  Serial.println(sensorValue);
  // Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
  float voltage = sensorValue * (5.0 / 1023.0);
  // print out the value you read:
  Serial.println(voltage);
  }
}

... going through a resistor ...

Can you sketch your circuit? That won't do much unless you have a voltage divider (ie. two resistors).

Example here of generating 0.87V reference voltage:

My resistor values are 220 kOhms and 4.7 MOhms

But how are they connected to the Arduino?

In my circuit above the LDR (the sensor in my case) is used as part of a voltage divider as well.

The maths for the 0.87V:

 1 / (1 + 4.7) * 5 = 0.877

Or in terms of resistor names:

voltage = R3 / (R2 + R3) * 5

http://www.raltron.com/cust/tools/voltage_divider.asp

Thank you so much for your prompt response! Based on your topmost figure above, I only had resistor R2; I did not have a resistor (R3) going to ground. Everything works as expected now. Thank you once again for your help!