This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace Largest_prime_factor | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <iostream> | |
using namespace std; | |
void main() | |
{ | |
long int factor = 600851475143; | |
for (long int divider = 2; divider < factor; divider++) | |
{ | |
(factor % divider == 0) ? factor /= divider, divider = 2 : NULL; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "stdafx.h" | |
#include <time.h> | |
#include <iostream> | |
using namespace std; | |
int reverse(int number); | |
int is_palindromic(int n); | |
int main() | |
{ | |
int biggest = 0; | |
clock_t begin = clock(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open System; | |
let sw = System.Diagnostics.Stopwatch() | |
sw.Start() | |
let ispalindrom (x):bool = | |
let s = x.ToString().ToCharArray() |> Array.rev | |
(new string(s) = x.ToString()) | |
printfn "%d" (seq { | |
for x in 899..999 do | |
for y in x..999 do | |
if ispalindrom (x*y) then yield (x*y) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. | |
' What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? | |
Module eular_5 | |
Function LCM(ByVal n1 As Long, ByVal n2 As Long) As Long | |
Dim tmp As Long, product As Long | |
product = n1 * n2 | |
Do | |
If n1 < n2 Then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function result() { | |
var i = 0; | |
var i2 = 0; | |
for (var z = 1; z <= 100; z++) { | |
i += z; | |
i2 += Math.pow(z, 2); | |
} | |
return Math.pow(i, 2) - i2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Text; | |
namespace eular_53 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
long exeedsmilliom = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Mobile Detect Library | |
* ===================== | |
* | |
* Motto: "Every business should have a mobile detection script to detect mobile readers" | |
* | |
* Mobile_Detect is a lightweight PHP class for detecting mobile devices (including tablets). | |
* It uses the User-Agent string combined with specific HTTP headers to detect the mobile environment. | |
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function visitor_country() { | |
$ip = $this->getRealIpAddr(); | |
$ip_data = @json_decode(file_get_contents("http://www.geoplugin.net/json.gp?ip=" . $ip)); | |
if ($ip_data && $ip_data->geoplugin_countryName != null) { | |
$result = $ip_data->geoplugin_countryName; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (!function_exists('timespan')) { | |
function timespan($seconds = 1, $time = '', $limit = -1) { | |
if ($limit == -1) | |
$limit = 99; | |
$CI = & get_instance(); | |
$CI->lang->load('date'); | |
if (!is_numeric($seconds)) { |
OlderNewer