user14387: If remembering correctly I once heard a Dhamma talk about the Buddha finding solace in/with the investigation of energy while (at least once) experiencing physical pain. What's the sutta reference(s) for this please?

user17652: I believe this might be the sutta in question. There may be other similar suttas.

On one occasion the Blessed One was dwelling at Rajagaha in the Bamboo
Grove, the Squirrel Sanctuary. Now on that occasion the Blessed One
was sick, afflicted, gravely ill. Then the Venerable Mahacunda
approached the Blessed One, paid homage to him, and sat down to one
side. The Blessed One then said to the Venerable Mahacunda:
“Recite the factors of enlightenment, Cunda.”
“These seven factors of enlightenment, venerable sir, have been
rightly expounded by the Blessed One; when developed and cultivated,
they lead to direct knowledge, to enlightenment, to Nibbāna. What
seven? The enlightenment factor of mindfulness has been rightly
expounded by the Blessed One; when developed and cultivated, it leads
to direct knowledge, to enlightenment, to Nibbāna…. The enlightenment
factor of equanimity has been rightly expounded by the Blessed One;
when developed and cultivated, it leads to direct knowledge, to
enlightenment, to Nibbāna. These seven factors of enlightenment,
venerable sir, have been rightly expounded by the Blessed One; when
developed and cultivated, they lead to direct knowledge, to
enlightenment, to Nibbāna.”
“Surely, Cunda, they are factors of enlightenment! Surely, Cunda, they
are factors of enlightenment!”
This is what the Venerable Mahacunda said. The Teacher approved. And
the Blessed One recovered from that illness. In such a way the Blessed
One was cured of his illness.
SN 46.16 - Ill


user16297: It's not investigation of energy, it's animitta samadhi that can relieve severe physical pain. SN 47.9:
Etarahi kho panāhaṃ, ānanda, jiṇṇo vuddho mahallako addhagato vayoanuppatto.
I’m now old, elderly and senior. I’m advanced in years and have reached the final stage of life.
Āsītiko me vayo vattati.
I’m currently eighty years old.
Seyyathāpi, ānanda, jajjarasakaṭaṃ veḷamissakena yāpeti;
Just as a decrepit cart keeps going by relying on straps,
evameva kho, ānanda, veḷamissakena maññe tathāgatassa kāyo yāpeti.
in the same way, the Realized One’s body keeps going by relying on straps, or so you’d think.
Yasmiṃ, ānanda, samaye tathāgato sabbanimittānaṃ amanasikārā ekaccānaṃ vedanānaṃ nirodhā animittaṃ cetosamādhiṃ upasampajja viharati, phāsutaro, ānanda, tasmiṃ samaye tathāgatassa kāyo hoti.
Sometimes the Realized One, not focusing on any signs, and with the cessation of certain feelings, enters and remains in the signless undistractible-lucidity of the heart. Only then does the Realized One’s body become more comfortable.
Tasmātihānanda, attadīpā viharatha attasaraṇā anaññasaraṇā, dhammadīpā dhammasaraṇā anaññasaraṇā.
So Ānanda, be your own island, your own refuge, with no other refuge. Let the teaching be your island and your refuge, with no other refuge.
link to full SN 47.9 sutta
https://lucid24.org/sn/sn47/sn47-v01/index.html#s9
==========================================
Bojjhanga "parittas", as they are usually presented, or implied, do not work as advertised. There's no way you can magically say 7 words and expect to be cured of fatal illnesses or debilitating physical pain.

14387: <p>If remembering correctly I once heard a Dhamma talk about the Buddha finding solace in/with the investigation of energy while (at least once) experiencing physical pain. What's the sutta reference(s) for this please?</p>
 17652: <p>I believe this might be the sutta in question. There may be other similar suttas.</p>
<blockquote>
<p>On one occasion the Blessed One was dwelling at Rajagaha in the Bamboo
Grove, the Squirrel Sanctuary. Now on that occasion the Blessed One
was sick, afflicted, gravely ill. Then the Venerable Mahacunda
approached the Blessed One, paid homage to him, and sat down to one
side. The Blessed One then said to the Venerable Mahacunda:</p>
<p>“Recite the factors of enlightenment, Cunda.”</p>
<p>“These seven factors of enlightenment, venerable sir, have been
rightly expounded by the Blessed One; when developed and cultivated,
they lead to direct knowledge, to enlightenment, to Nibbāna. What
seven? The enlightenment factor of mindfulness has been rightly
expounded by the Blessed One; when developed and cultivated, it leads
to direct knowledge, to enlightenment, to Nibbāna…. The enlightenment
factor of equanimity has been rightly expounded by the Blessed One;
when developed and cultivated, it leads to direct knowledge, to
enlightenment, to Nibbāna. These seven factors of enlightenment,
venerable sir, have been rightly expounded by the Blessed One; when
developed and cultivated, they lead to direct knowledge, to
enlightenment, to Nibbāna.”</p>
<p>“Surely, Cunda, they are factors of enlightenment! Surely, Cunda, they
are factors of enlightenment!”</p>
<p>This is what the Venerable Mahacunda said. The Teacher approved. And
the Blessed One recovered from that illness. In such a way the Blessed
One was cured of his illness.</p>
<p><a href="https://suttacentral.net/sn46.16/en/bodhi" rel="nofollow noreferrer">SN 46.16 - Ill</a></p>
</blockquote>
 16297: <p>It's not investigation of energy, it's animitta samadhi that can relieve severe physical pain. SN 47.9:</p>
<p>Etarahi kho panāhaṃ, ānanda, jiṇṇo vuddho mahallako addhagato vayoanuppatto.
I’m now old, elderly and senior. I’m advanced in years and have reached the final stage of life.
Āsītiko me vayo vattati.
I’m currently eighty years old.
Seyyathāpi, ānanda, jajjarasakaṭaṃ veḷamissakena yāpeti;
Just as a decrepit cart keeps going by relying on straps,
evameva kho, ānanda, veḷamissakena maññe tathāgatassa kāyo yāpeti.
in the same way, the Realized One’s body keeps going by relying on straps, or so you’d think.
Yasmiṃ, ānanda, samaye tathāgato sabbanimittānaṃ amanasikārā ekaccānaṃ vedanānaṃ nirodhā animittaṃ cetosamādhiṃ upasampajja viharati, phāsutaro, ānanda, tasmiṃ samaye tathāgatassa kāyo hoti.
Sometimes the Realized One, not focusing on any signs, and with the cessation of certain feelings, enters and remains in the signless undistractible-lucidity of the heart. Only then does the Realized One’s body become more comfortable.
Tasmātihānanda, attadīpā viharatha attasaraṇā anaññasaraṇā, dhammadīpā dhammasaraṇā anaññasaraṇā.
So Ānanda, be your own island, your own refuge, with no other refuge. Let the teaching be your island and your refuge, with no other refuge.</p>
<p>link to full SN 47.9 sutta
<a href="https://lucid24.org/sn/sn47/sn47-v01/index.html#s9" rel="nofollow noreferrer">https://lucid24.org/sn/sn47/sn47-v01/index.html#s9</a></p>
<p>==========================================
Bojjhanga &quot;parittas&quot;, as they are usually presented, or implied, do not work as advertised. There's no way you can magically say 7 words and expect to be cured of fatal illnesses or debilitating physical pain.</p>
