php-es.org
Submit
Archive
RECENT PASTES
juchipilo
19 hours ago
vejotren
5 days ago
juchipilo
81 days ago
juchipilo
130 days ago
download-youtube
337 days ago
Anonymous
340 days ago
OSPHPChat
340 days ago
Welcome! Here you can paste sources and general debugging text, You can even set yourself a password if you want to keep it just for yourself.
Posted by juchipilo on October Fri 14th 11:31 PM - Never Expires
Download
|
New paste
#!/usr/bin/php -q
<?php
$num
=
1
;
$sum
=
0
;
$top
=
2000000
;
while
(
$num
<
$top
)
{
if
(
isprime
(
$num
)
)
{
$sum
+=
$num
;
}
$num
++;
}
print
"la suma de los primos menores a {$top} es {$sum}
\n
"
;
function
isprime
(
$number
)
{
if
(
$number
==
1
)
return
false
;
if
(
$number
==
2
)
return
true
;
if
(
$number
==
3
)
return
true
;
$topcheck
=
max
(
2
,
intval
(
sqrt
(
$number
)
)
)
;
for
(
$i
=
2
;
$i
<=
$topcheck
;
$i
++
)
{
if
(
$number
%
$i
==
0
)
{
return
false
;
}
}
return
true
;
}
Language:
Apt sources.list
BASH
C
C++
CSS
HTML 4.01 strict
Java
JavaScript
mIRC
Perl
PHP
Plain text
Python
Ruby on Rails
Ruby
SQL
TCL
WHOIS (RPSL format)
XML
xorg.conf
----------------------------
ABAP
ActionScript
ActionScript 3
Ada
Apache
AppleScript
Apt sources.list
ASM
ASP
AutoIt
AviSynth
BASH
Basic4GL
Brainfuck
BibTeX
BlitzBasic
BNF
Boo
C
C for Macs
CADDCL
CADLisp
CFDG
ColdFusion
CIL
CMake
COBOL
C++ (with QT extensions)
C++
C#
CSS
D
DCS
Delphi
Diff-output
DIV
DOS
dot
Eiffel
E-mail (mbox\eml\RFC format)
Erlang
FO
Fortran
FreeBasic
Genero
GNU Gettext .po/.pot
glSlang
GML
GNUPlot
Groovy
Haskell
HQ9+
HTML 4.01 strict
Unoidl
INI
Inno Script
INTERCAL
IO
Java
Java 5
JavaScript
KiXtart
KLone with C
KLone with C++
LaTeX
Generic Lisp
Locomotive Basic
LOLcode
@Formula/@Command
LotusScript
Lightwave Script
Linden Script
LUA
Motorola 68000 Assembler
GNU make
Matlab
mIRC
Modula-3
Microchip Assembler
MXML
MySQL
NSIS
Oberon-2
Objective-C
Objective Caml
OOo Basic
Oracle 11i
Oracle 8
Pascal
Per (forms)
Perl
PHP (Brief version)
PHP
PIC16 Assembler
Pixel Bender
Plain text
Oracle 9.2 PL/SQL
Povray
PowerShell
Progress
Prolog
Property
ProvideX
Python
QuickBASIC
Ruby on Rails
Rebol
Microsoft REGEDIT
Robots.txt
Ruby
SAS
Scala
Scheme
SciLab
sdlBasic
Smalltalk
Smarty
SQL
TCL
Tera Term Macro
thinBasic
T-SQL
TypoScript
Visual Basic
Visual Basic .NET
Verilog
VHDL
Vim
Visual FoxPro
Visual Prolog
Whitespace
WHOIS (RPSL format)
WinBatch
XML
xorg.conf
Axapta/Dynamics Ax X++
ZiLOG Z80 Assembler
To highlight particular lines, prefix each line with @@
#!/usr/bin/php -q <?php $num = 1; $sum = 0; $top = 2000000; while ( $num < $top){ if ( isprime($num)){ $sum += $num; } $num++; } print "la suma de los primos menores a {$top} es {$sum}\n"; function isprime($number){ if ($number == 1) return false; if ($number == 2) return true; if ($number == 3) return true; $topcheck = max(2, intval(sqrt($number))); for ( $i=2; $i <= $topcheck; $i++){ if ( $number % $i ==0 ){ return false; } } return true; }
Name/Title (Optional)
How long should we keep your paste?
One day
One month
Forever
Password (Optional)
© 2012 - Powered by
PASTE
1.0