20181212, 10:05  #1 
May 2016
2×3^{4} Posts 
Strange formula
Good morning ,
I am testing this formula and I believe it produces many prime numbers when the result is an odd number. I can not find any logical relationship with this formula in general but interesting to show. P.S. especially if is a prime number . 
20181212, 15:27  #2 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
9,431 Posts 
'When all you have is a screwdriver, everything looks like a nail to you'
...or something like that. 
20181213, 02:35  #3  
Aug 2006
1011101100001_{2} Posts 
Quote:
It can be proven that the rounded value of \(f_n\) is asymptotically almost surely composite, whether n is taken odd or even. That is, the probability that \(f_n\) is composite is, in the limit, 100%. 

20181213, 09:06  #4  
May 2016
242_{8} Posts 
Quote:
Program.py Code:
ii=1 i2=0 GG=0 FF=0 VV =0 e = 0 AA=0 c = 1 a =1 bb=0 dd=0 I=1 II=0 i=1 i1=0 #b=5*a d=5 e=1 bb=input('Inserire numero: ') while c<=bb: b=5*a #e=5*a #d=e//5 funzione=(3.14*2**3.14*a)//((3.14*2**3.14*(5*a))**(1/2.0)) #e=5*a #d=e//5 #b=5*a #d=funzione #d=d*3+1 b=funzione print(' N= >' , a) print('Funzione',funzione) #if a==1 or 2: #print('A un numero primo ',a) while I<=funzione: I=I*1 I=I+1 if funzione == I: print(' F is a prime number ', funzione) AA=AA+1 break if funzione % I == 0 : break I=1 a=a+1 c=c+1 print('\n\n\nTOTALE PRIME NUMBER FOUND : ',AA) For example prime number 73 there is from n = 963 to n = 989 ( or equal from n = 963*5 to n = 989*5) Code:
(' N= >', 963) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 964) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 965) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 966) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 967) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 968) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 969) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 970) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 971) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 972) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 973) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 974) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 975) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 976) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 977) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 978) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 979) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 980) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 981) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 982) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 983) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 984) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 985) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 986) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 987) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 988) ('Funzione', 73.0) (' F is a prime number ', 73.0) (' N= >', 989) ('Funzione', 73.0) (' F is a prime number ', 73.0) 

20181213, 14:59  #5  
Feb 2017
Nowhere
4544_{10} Posts 
Quote:


20181214, 06:51  #6  
Aug 2006
3^{2}·5·7·19 Posts 
Quote:


20181214, 13:31  #7  
Feb 2017
Nowhere
4544_{10} Posts 
Quote:
m <= c*sqrt(n) < (m+1) then m^2 <= c^2 * n < (m+1)^2, so that m^2/c^2 <= n < (m+1)^2/c^2. This places n in an interval of length (2*m + 1)/c^2. Now, let's see what rounding gives. If m  1/2 <= c*sqrt(n) <= m + 1/2, then (m  1/2)^2 <= c^2 * n <= (m + 1/2)^2, so that (m  1/2)^2/c^2 <= n <= (m + 1/2)^2/c^2. This places n in an interval of length 2*m/c^2. In either case, we have a pretty good handle on how many values of n produce a given value of m, because the length of an interval is, pretty nearly, the number of integers it contains. And now, a trip to Fallacy Land. Looking at the formulas, we see that the interval lengths for the two methods are different. The interval for the floor is consistently longer than the interval for rounding. So, using the integer floor will always give at least as many nvalues producing a given m as rounding. An excess will inexorably build up. But that means the two methods will eventually produce different counts of the number of integers up to the same point! Oh, dear! What are we going to do??? 

20181214, 16:30  #8 
Aug 2006
1761_{16} Posts 
Not that it fundamentally changes the analysis, but the OP's second post clarified two things: the function is rounded down (not to nearest or closest or something funny) and the value used is not \(\pi\) but 3.14, which changes the 989th value (mentioned in said post) from 74 to 73.

20181215, 02:42  #9  
Romulan Interpreter
Jun 2011
Thailand
3×47×67 Posts 
Quote:
Can I pick Mills' constant? As far as we can go, that only generates primes... @OP: Joking apart, this formula does not produce more primes than expected. Think about it, prime numbers are very dense, especially when small, which makes this type of fallacies very common. Under 100, there are 25 primes. And if you limit it to odd numbers only, then half of the odd numbers under 100 are primes. Under a thousand, more than a third of the odd numbers are prime (there are 168 primes under 1000). So, this algorithm generates a lot of prime numbers: "take a coin and throw it up 50 times, count the number of heads, multiply by 2 and add 1. Write down the result." You will, for sure, see a lot of primes. Do it to 500. You will see a lot of primes too. But when you count them, they will not be more than half (or respectively a third) of the total numbers. Take a dice, throw it out 31 times, add the numbers together, multiply by 6 (why? because the dice has 6 faces ), then if either result1 or result+1 or result5 or result+5 or result7 or the result+7 is prime, you got a success, otherwise you got a fail. This "formula" generates ONLY prime numbers (successes). Now take your formula and make it print few 100digits numbers. See how many of them are prime. If you get half of them prime, then we talk. But even then, you may get none at 1000 digits... Last fiddled with by LaurV on 20181215 at 03:50 

20181215, 04:07  #10 
"Serge"
Mar 2008
Phi(4,2^7658614+1)/2
9,431 Posts 
So this formula generates more or less all numbers.
How is it better than f(n)=n ? I would say f(n)=n is way better. It generates only primes, especially when n is prime! Exactly!! 
20181215, 13:16  #11  
Feb 2017
Nowhere
2^{6}×71 Posts 
Quote:
? n1=floor(sqrt(Pi*2^Pi*26/5));n2=floor(sqrt(3.14*2^3.14*26/5));print(n1);print(n2) 12 11 This is the first value of n for which the nth values differ. Of course, the two functions differ for every sufficiently large n; and by an everincreasing amount. 

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
Interesting formulĂ¦  Uncwilly  Lounge  29  20130505 16:12 
P1 formula (help wanted)  Prime95  Data  18  20120212 18:07 
prime formula  meeztamike  Miscellaneous Math  11  20100718 04:13 
New LLT formula  hoca  Math  7  20070305 17:41 
General formula  pacionet  Miscellaneous Math  15  20051208 08:00 