<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=2547_-_Divizori_3</id>
	<title>2547 - Divizori 3 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.universitas.ro/index.php?action=history&amp;feed=atom&amp;title=2547_-_Divizori_3"/>
	<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=2547_-_Divizori_3&amp;action=history"/>
	<updated>2026-05-01T08:49:22Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=2547_-_Divizori_3&amp;diff=2984&amp;oldid=prev</id>
		<title>Paul Matei at 11:31, 6 April 2023</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=2547_-_Divizori_3&amp;diff=2984&amp;oldid=prev"/>
		<updated>2023-04-06T11:31:06Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 11:31, 6 April 2023&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l58&quot;&gt;Line 58:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 58:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;==Explicație rezolvare==&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Acest cod Python are ca scop găsirea numărului de numere care au exact trei divizori, între două numere date.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Funcția &#039;&#039;&#039;validare_date&#039;&#039;&#039; primește două numere sub formă de string și returnează o valoare booleană, &#039;&#039;&#039;True&#039;&#039;&#039; dacă cele două numere sunt valide și &#039;&#039;&#039;False&#039;&#039;&#039; dacă nu sunt. Pentru ca cele două numere să fie considerate valide, trebuie să fie numere întregi pozitive, cu o valoare cuprinsă între 1 și 1 miliard, iar diferența dintre cele două numere trebuie să fie mai mică sau egală cu 1000.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Funcția &#039;&#039;&#039;numar_divizori&#039;&#039;&#039; primește un număr întreg pozitiv și returnează o valoare booleană, &#039;&#039;&#039;True&#039;&#039;&#039; dacă numărul are exact trei divizori și &#039;&#039;&#039;False&#039;&#039;&#039; dacă nu. Pentru a determina numărul de divizori, funcția parcurge toți divizorii numărului și îi numără. Dacă numărul de divizori ajunge la 3, atunci funcția returnează &#039;&#039;&#039;True&#039;&#039;&#039;, în caz contrar, returnează &#039;&#039;&#039;False&#039;&#039;&#039;.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Funcția &#039;&#039;&#039;main&#039;&#039;&#039; este funcția principală care este apelată la pornirea programului. Funcția primește de la utilizator două numere sub formă de &#039;&#039;&#039;string&#039;&#039;&#039;, le validează folosind funcția &#039;&#039;&#039;validare_date&#039;&#039;&#039;, le convertește la &#039;&#039;&#039;intregi&#039;&#039;&#039; și calculează numărul de numere care au exact trei divizori, apelând funcția &#039;&#039;&#039;numar_divizori&#039;&#039;&#039;. Numărul de astfel de numere este apoi afișat. În cazul în care datele introduse nu sunt valide, funcția afișează un mesaj de eroare.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Astfel, acest program primește două numere de la utilizator și afișează numărul de numere care au exact trei divizori între aceste două numere.&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Paul Matei</name></author>
	</entry>
	<entry>
		<id>https://wiki.universitas.ro/index.php?title=2547_-_Divizori_3&amp;diff=984&amp;oldid=prev</id>
		<title>Paul Matei: Pagină nouă: == Cerinţa == Se citesc două numere naturale &#039;&#039;&#039;numar1&#039;&#039;&#039; și &#039;&#039;&#039;numar2&#039;&#039;&#039; (&#039;&#039;&#039;numar1 &lt; numar2&#039;&#039;&#039;) având cel mult &#039;&#039;&#039;9&#039;&#039;&#039; cifre fiecare. Afișați câte numere din intervalul &#039;&#039;&#039;[numar1, numar2]&#039;&#039;&#039; au exact &#039;&#039;&#039;3&#039;&#039;&#039; divizori. == Date de intrare == Programul citește de la tastatură numerele &#039;&#039;&#039;numar1&#039;&#039;&#039; și &#039;&#039;&#039;numar2&#039;&#039;&#039;, separate printr-un spațiu. == Date de ieşire == Programul va afișa pe ecran numărul de numere din intervalul &#039;&#039;&#039;[numar1,numar2]&#039;&#039;&#039;care au exact &#039;&#039;&#039;3&#039;&#039;...</title>
		<link rel="alternate" type="text/html" href="https://wiki.universitas.ro/index.php?title=2547_-_Divizori_3&amp;diff=984&amp;oldid=prev"/>
		<updated>2023-03-18T17:33:35Z</updated>

		<summary type="html">&lt;p&gt;Pagină nouă: == Cerinţa == Se citesc două numere naturale &amp;#039;&amp;#039;&amp;#039;numar1&amp;#039;&amp;#039;&amp;#039; și &amp;#039;&amp;#039;&amp;#039;numar2&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;numar1 &amp;lt; numar2&amp;#039;&amp;#039;&amp;#039;) având cel mult &amp;#039;&amp;#039;&amp;#039;9&amp;#039;&amp;#039;&amp;#039; cifre fiecare. Afișați câte numere din intervalul &amp;#039;&amp;#039;&amp;#039;[numar1, numar2]&amp;#039;&amp;#039;&amp;#039; au exact &amp;#039;&amp;#039;&amp;#039;3&amp;#039;&amp;#039;&amp;#039; divizori. == Date de intrare == Programul citește de la tastatură numerele &amp;#039;&amp;#039;&amp;#039;numar1&amp;#039;&amp;#039;&amp;#039; și &amp;#039;&amp;#039;&amp;#039;numar2&amp;#039;&amp;#039;&amp;#039;, separate printr-un spațiu. == Date de ieşire == Programul va afișa pe ecran numărul de numere din intervalul &amp;#039;&amp;#039;&amp;#039;[numar1,numar2]&amp;#039;&amp;#039;&amp;#039;care au exact &amp;#039;&amp;#039;&amp;#039;3&amp;#039;&amp;#039;...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Cerinţa ==&lt;br /&gt;
Se citesc două numere naturale &amp;#039;&amp;#039;&amp;#039;numar1&amp;#039;&amp;#039;&amp;#039; și &amp;#039;&amp;#039;&amp;#039;numar2&amp;#039;&amp;#039;&amp;#039; (&amp;#039;&amp;#039;&amp;#039;numar1 &amp;lt; numar2&amp;#039;&amp;#039;&amp;#039;) având cel mult &amp;#039;&amp;#039;&amp;#039;9&amp;#039;&amp;#039;&amp;#039; cifre fiecare. Afișați câte numere din intervalul &amp;#039;&amp;#039;&amp;#039;[numar1, numar2]&amp;#039;&amp;#039;&amp;#039; au exact &amp;#039;&amp;#039;&amp;#039;3&amp;#039;&amp;#039;&amp;#039; divizori.&lt;br /&gt;
== Date de intrare ==&lt;br /&gt;
Programul citește de la tastatură numerele &amp;#039;&amp;#039;&amp;#039;numar1&amp;#039;&amp;#039;&amp;#039; și &amp;#039;&amp;#039;&amp;#039;numar2&amp;#039;&amp;#039;&amp;#039;, separate printr-un spațiu.&lt;br /&gt;
== Date de ieşire ==&lt;br /&gt;
Programul va afișa pe ecran numărul de numere din intervalul &amp;#039;&amp;#039;&amp;#039;[numar1,numar2]&amp;#039;&amp;#039;&amp;#039;care au exact &amp;#039;&amp;#039;&amp;#039;3&amp;#039;&amp;#039;&amp;#039; divizori.&lt;br /&gt;
== Restricții și precizări ==&lt;br /&gt;
* &amp;#039;&amp;#039;&amp;#039;1 ≤ numar1&amp;lt; numar2 &amp;lt; 1.000.000.000&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
== Exemplu ==&lt;br /&gt;
; Intrare&lt;br /&gt;
: 11 50&lt;br /&gt;
; Ieșire&lt;br /&gt;
: 2&lt;br /&gt;
== Explicație == &lt;br /&gt;
Numerele din intervalul &amp;#039;&amp;#039;&amp;#039;[11,50]&amp;#039;&amp;#039;&amp;#039; care au exact &amp;#039;&amp;#039;&amp;#039;3&amp;#039;&amp;#039;&amp;#039; divizori sunt &amp;#039;&amp;#039;&amp;#039;25&amp;#039;&amp;#039;&amp;#039; și &amp;#039;&amp;#039;&amp;#039;49&amp;#039;&amp;#039;&amp;#039;.&lt;br /&gt;
== Rezolvare ==&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line&amp;gt;&lt;br /&gt;
def validare_date(numar1, numar2):&lt;br /&gt;
    flag = False&lt;br /&gt;
&lt;br /&gt;
    if numar1.isdigit() and numar2.isdigit():&lt;br /&gt;
        if 0 &amp;lt; int(numar1) &amp;lt; int(numar2) &amp;lt;= 1_000_000_000 and int(numar2) - int(numar1) &amp;lt;= 1000:&lt;br /&gt;
            flag = True&lt;br /&gt;
&lt;br /&gt;
    return flag&lt;br /&gt;
&lt;br /&gt;
def numar_divizori(n):&lt;br /&gt;
    divizori = 0&lt;br /&gt;
    for i in range(1, int(n**0.5) + 1):&lt;br /&gt;
        if n % i == 0:&lt;br /&gt;
            divizori += 2&lt;br /&gt;
            if n // i == i:&lt;br /&gt;
                divizori -= 1&lt;br /&gt;
        if divizori &amp;gt; 3:&lt;br /&gt;
            break&lt;br /&gt;
    return divizori == 3&lt;br /&gt;
&lt;br /&gt;
def main():&lt;br /&gt;
    numar1, numar2 = input().split()&lt;br /&gt;
&lt;br /&gt;
    if validare_date(numar1, numar2):&lt;br /&gt;
        numar1 = int(numar1)&lt;br /&gt;
        numar2 = int(numar2)&lt;br /&gt;
&lt;br /&gt;
        numar = 0&lt;br /&gt;
        for i in range(numar1, numar2 + 1):&lt;br /&gt;
            if numar_divizori(i):&lt;br /&gt;
                numar += 1&lt;br /&gt;
&lt;br /&gt;
        print(numar)&lt;br /&gt;
&lt;br /&gt;
    else:&lt;br /&gt;
        print(&amp;quot;Datele de intrare nu corespund restricțiilor impuse.&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
if __name__ == &amp;quot;__main__&amp;quot;:&lt;br /&gt;
    main()&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Paul Matei</name></author>
	</entry>
</feed>