Numbers where n! - 1 or n! + 1 is a prime
Combination of OEIS A002981 and OEIS A002982
Sandbox note: This is my first code-golf challenge; feedback is highly appreciated.
Output the nth non-negative integer m where m! - 1 or m! + 1 is a prime.
The first few numbers of the sequence are 0, 1, ...
Used for things like displaying as a percentage, or as a dollar-and-cents amount, or to a certain precision, etc. Here, we're converting to hex with the x specifier.
"tallest pyramid given a certain number of blocks, as well as number of blocks left over"
pyramid requires 1+2+3+4+... blocks
so if you have n blocks you need to solve for t(t+1)/2 <= n
to get the height of the pyramid
and then n-t(t+1)/2 tells you the blocks left over
for example if I have 12 blocks, I can a pyramid with 1+2+3+4 = 10 blocks (If I added layer 5 I'd need 15 blocks, which I don't have). So I can make a pyramid of height 4, with 12 - 10 = 2 blocks left over
What?! This question doesn't exist yet?
What general tips do you have for golfing in QBasic? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to QBasic (e.g. "remove comments" is not an answer).