My piano teacher taught me some way to find sharps and flats of a scale only given its name(which I forgot), and using knowledge of a relative scale, like G major is relative to E minor. If I’m given a random scale, like F♯ major, how could I come up with its sharps without previous knowledge of it.
It's been 70 or more years since I learned this but this is one way with some side benefits.
First: know the Circle of Fifths (AKA Circle of Fourths, Cycle of Fifths, Cycle of Fourths, etc). Starting with C, one goes up (at least I think of it as up) by fifths to G,D,A,E,B,F#,C# (which is far enough) by adding a single sharp to the key signature. The note getting it is the 7th of the new key (or fourth of the old key), C gets F# to become G, etc. Running backwards, (C,F,Bb,Eb,Ab,Db,Gb,Cb) "falling fifths as I think of them, the way many harmonic progressions go.) The flat is added to the seventh note of the starting key (or fourth of the new key).
Now, one can count the number of fifths up or fourths down from C to get the number of sharps or flats. I don't have any mnemonics for remembering these.
Relative key are easy. The relative minor is a minor third (below the tonic) and the relative major is a minor third above. Thus for C, the relative minor is A and the relative major for C minor is Eb. I usually just think of the relative major as being three flats down. (I don't much worry about a relative major for some region; it's three-sharps up but these sharps are not used in the minor. Counting notes is easy.)
The Cycle of Fifths works for minor keys too. A minor has zero sharps, E minor has 1, etc.
There is no simple way to obtain what you ask without a fair bit of knowledge already. And by the time you have gleaned that, you probably won't come across a key or scale that you don't know anyway!
Apart from the already quoted cirles of 4/5ths, there is a simple formula for obtaining the notes in any scale.
That is: T T S T T T S - or put another way, W W H W W W H.
This tells the gaps between each note in a major scale, sequentially. T= tone, S= semitone, W= whole note, H= half note. T and W are the same.
So, start with the root note, let's use C. A tone up gives D, another tone E, then a semitone to F. Then three tones, making G A and B. The last step is a semitone back to an octave above root - C,
Try it on F♯ +T=G♯, +T= A♯. +S=B. +T=C♯, +T= D♯, +T= E♯. Job done!. Note carefully - each subsequent letter will be the next letter - there are no two notes with the same letter.
Minors are for another day - they aren't as simple!
This is something that you just have to learn.
You know the alphabet don't you: 26 different letters with at least two versions of each. Learning your keys is a smaller task than learning your letters.
Aim to learn a new one each day. Revise all of them the next day and add another one. In six weeks time you will wonder why you were so worried about it.
There are many tricks, mnemonics and videos to learn the keys and signatures.
The fastest and easiest way will be:
Write with a non-permanent pen the names F,B♭,E♭,A♭,D♭, on your fingers 1,2,3,4,5,
Write with a non-permanent pen the names G,D,A,E,B, on your fingers 1,2,3,4,5,
How to find the numbers of sharps and flats in minor keys?
Number of sharps: Minor=Major-3#
Number of flats: Minor= Major+3♭
How finding the numbers of sharps and flats in major keys?
There are several mnemonics to memorize the circle ...
My advice is:
First mind on the top of the circle we have (0#/0♭) on the left F=1b, on the right G=1#, (the 3 chords we need to play the cadence I-IV-V-I -> C,F,G,C).
At “6 o’clock” we have the enharmonic equivalent F#/Gb -> 6#/6♭.
how to find the numbers of the others scales and keys?
mind the word BEAD:
reading the circle counter-clock-wise starting at "12 o'clock" with C=0♭:
B♭,E♭,A♭,D♭ => 2♭,3♭,4♭,5♭ and: G♭->6♭
starting at 6 o'clock: F# =6#
B,E,A,D => 5#,4#,3#,2# and G->1#
there are several other verses of words beginning with the letters of the names of scales and keys that you can tell and count the sharps and flags on your fingers, like:
Father Christmas gives Dad an electric blanket. (flats)
Fuzzy Cats Get Dirty After Every Bath (flats)
Blanket explodes and Dad gets cold feet. (Circle of 5ths from B to F)
btw: there are lots of youtube videos teaching the circle of 5ths:
My further advice is (also for beginners!):
Try to develop all scales by playing and writing the tetra-chords and you will not only memorize the stuff, but will really learn and understand it!
Then draw yourself a circle of fifths, look at it with full concentration, make a fotograph of it with your mind, close your eyes and try to see it inside: the clock from 1 to 6 o'clock, the name of keys/scales, the key signature and the name of keys: G,A,D,E,F# and then do the same with the flats.
If you're interested in more about the circle of fifths,
this is a good video:strong text