You have a mixture of Arduino and avr gcc code.
The Arduino uses the arv gcc compiler, and every low level function can also be used with the Arduino.
For the Arduino, the 'F()' macro is created:
Serial.println(F("Hello string in flash memory"));
But the 'F()' macro is something typical for the Arduino IDE only.
The sprintf_P() functions are avr gcc functions, they work with PSTR.
sprintf_P( buffer, PSTR("Hello number twelve: %d"), 12);
Perhaps this will be fixed some day. For now it is a little inconsistant.