PDA

View Full Version : VBA Mac coding Question



LPUG
02-26-2021, 12:23 PM
Trying to write code to show prime numbers 3-1000, then show the sum of the digits of each of those prime numbers, and ultimately just show the prime numbers whose sum is prime. Example the number is 11 to show 1+1=2, 2 would also be shown because it is also a prime number. I have the code working for prime numbers, however cannot get it to sum the digits or show the summed primes. Please help!

Aussiebear
02-27-2021, 04:41 PM
Have you tried this?
=SUMPRODUCT(--MID(A1,ROW(INDIRECT("1:" & LEN(A1))),1))

Paul92688
07-15-2021, 11:59 AM
I see this was posted a few months ago. Are you still working on the problem? If so, you mention the sum of digits of 11 is 2 and 2 is prime. Are you summing all the digits of all the primes or only the sum of the digits that result in a prime sum? Are you doing this all in VBA or are you displaying all primes <1000 on a spreadsheet?