frommathimport*l=#type l here (value given to you) m=#type m here (value given to you) defprimefact(x):ifx==1:return[]ifx%2==0:return[2]+primefact(x/2)ifx%3==0:return[3]+primefact(x/3)forainrange(1,int(((x+1)**0.5)/6+1)+1):ifx%(6*a-1)==0:return[6*a-1]+primefact(int(x/(6*a-1)))ifx%(6*a+1)==0:return[6*a+1]+primefact(int(x/(6*a+1)))return[x]forbinrange(0,1+int(log(m,2))):c=str(b)a="a"+cglobals()[a]=[]print("processing%")forainrange(l,m):ifa%(10**5)==0:print((a-l)/(m-l)*100)eval("a"+str(len(primefact(a)))+".append("+str(a)+")")print("processing finished. final data is below")foriinrange(0,int(log(m,2))+1):print(eval("len(a"+str(i)+")"))
Variablevalues :
Name of participant
Value of l
Value of m
Akela Chana
108
5×106+108
Siddharth Chakravarty
5×106+108
107+108
David Stiff
107+108
5×106+107+108
Vinayak Srivastava
5×106+107+108
2×107+108
Aryan Sanghi
2×107+108
5×106+2×107+108
Jeff Giff
5×106+2×107+108
3×107+108
Zakir Husain
3×107+108
5×106+3×107+108
Someimportantthing:
Some of the participants might think that how to manage time?
So, what I will suggest is that- You don't need to run the whole program all that once you can break it into pieces, like I can break my work into :
(l=6×107+108;m=6.5×107+108) and (l=6.5×107+108;m=7×107+108)
And then running each program a day and thus completing my work within a week.
An important announcement regarding the input and output is - Kindly send the input and the output you gave both, either through screenshots (which I suggests), or through any other way.
If you are breaking your work into pieces as I mentioned before, then send output of each part with it's input.
Note :
If someone still can't complete his work then he can voluntarily ask for reduction, his work then will be transferred to me (some of it).
If any of you will complete your work before the end of the week and wanted more then you can voluntarily ask for it.
If you are having any doubts related to this then clear it here.
If you also want to participate (you are not a participant right now) then you can register your name for coming week (week 2) and this week also.
If you know a better programming language then kindly suggest.
A request to Páll Márton to kindly share the flow chart of the algorithm he used in this program.
This discussion board is a place to discuss our Daily Challenges and the math and science
related to those challenges. Explanations are more than just a solution — they should
explain the steps and thinking strategies that you used to obtain the solution. Comments
should further the discussion of math and science.
When posting on Brilliant:
Use the emojis to react to an explanation, whether you're congratulating a job well done , or just really confused .
Ask specific questions about the challenge or the steps in somebody's explanation. Well-posed questions can add a lot to the discussion, but posting "I don't understand!" doesn't help anyone.
Try to contribute something new to the discussion, whether it is an extension, generalization or other idea related to the challenge.
Stay on topic — we're all here to learn more about math and science, not to hear about your favorite get-rich-quick scheme or current world events.
Markdown
Appears as
*italics* or _italics_
italics
**bold** or __bold__
bold
- bulleted - list
bulleted
list
1. numbered 2. list
numbered
list
Note: you must add a full line of space before and after lists for them to show up correctly
from math import *
l=((5*(10**6)+10**7+10**8))
m=((2*(10**7)+10**8))
def primefact(x):
if x==1:return []
if x%2==0:return [2]+primefact(x/2)
if x%3==0:return [3]+primefact(x/3)
for a in range(1,int(((x+1)**0.5)/6+1)+1):
if x %(6*a-1)==0:
return [6*a-1]+primefact(int(x/(6*a-1)))
if x %(6*a+1)==0:
return [6*a+1]+primefact(int(x/(6*a+1)))
return [x]
for b in range(0,1+int(log(m,2))):
c=str(b)
a="a"+c
globals()[a]=[]
print("processing%")
for a in range(l,m):
if a%(10**5)==0:print((a-l)/(m-l)*100)
eval("a"+str(len(primefact(a)))+".append("+str(a)+")")
print("processing finished. final data is below")
for i in range(0,int(log(m,2))+1):
print(eval("len(a"+str(i)+")"))
@A Former Brilliant Member
–
Yes, something like that (see here), you can also describe your algorithm instead (in words if you don't want to use flow chart or if you are comfortable in it)
Yes, I have printed extra stuff so that you are sure, that your computer haven't hang. Because when I ran it in my PC it hanged, when I printed these thing it worked. The output is correct
While I am running in my code, it is saying syntax error and some other ones, I copied everything correctly. Could you help, as I am still learning to code?
Easy Math Editor
This discussion board is a place to discuss our Daily Challenges and the math and science related to those challenges. Explanations are more than just a solution — they should explain the steps and thinking strategies that you used to obtain the solution. Comments should further the discussion of math and science.
When posting on Brilliant:
*italics*
or_italics_
**bold**
or__bold__
paragraph 1
paragraph 2
[example link](https://brilliant.org)
> This is a quote
\(
...\)
or\[
...\]
to ensure proper formatting.2 \times 3
2^{34}
a_{i-1}
\frac{2}{3}
\sqrt{2}
\sum_{i=1}^3
\sin \theta
\boxed{123}
Comments
Input:
Output:
Log in to reply
Our output numbers are nearly same! Does this mean that primes are distributed uniformly?
Input:
Output:
Log in to reply
I won't be able to participate in further events till September, my exams will start from 28th July. Sorry.
@Aryan Sanghi, @Vinayak Srivastava, @Akela Chana, @Jeff Giff, @Siddharth Chakravarty, @David Stiff,
@Páll Márton, Kindly share the flow chart of your program
Log in to reply
What is the flow chart?
Log in to reply
A picture about the working of my program step by step?
Log in to reply
see here), you can also describe your algorithm instead (in words if you don't want to use flow chart or if you are comfortable in it)
Yes, something like that (Log in to reply
Everyone : The Note can be edited anytime today as required, so please check the note frequently
Log in to reply
Also don't start working till I tell to do so.
@Zakir Husain I typed in the values of l and m as 2 and 10 respectively just for trial. It gave me this output, is it correct?
Log in to reply
Yes, I have printed extra stuff so that you are sure, that your computer haven't hang. Because when I ran it in my PC it hanged, when I printed these thing it worked. The output is correct
Log in to reply
Are my values of l and m in python code correct? See below:
Log in to reply
Announcement: everyone can now start their work from now.
Log in to reply
While I am running in my code, it is saying syntax error and some other ones, I copied everything correctly. Could you help, as I am still learning to code?
Log in to reply
Don't use interpreter, use IDLE instead. Interpreter doesn't always support copying and pasting.
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
Log in to reply
New Note
Hi Zakir. Here is my interval. Took about 10 minutes:
Output:
@Akela Chana @Jeff Giff
Announcement: New plan is here, everything is nearly changed now