summaryrefslogtreecommitdiff
path: root/isprime
blob: 1f34dccb6d1a3f63907ec831927f47afa32733f4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/ruby

def is_prime(n)
	if n <= 2
		return true
	elsif n.modulo(2) == 0
		return false
	else
		3.step(Math.sqrt(n).ceil, 2) do |i|
			if n.modulo(i) == 0
				return false
			end
		end
		return true
	end
end

if ARGV.length < 1
	puts "Usage: isprime number [number...]"
else
	ARGV.each do |n|
		if n.to_i < 1
			puts "Negative numbers and 0 not allowed."
			exit
		elsif is_prime(n.to_i)
			puts n.to_s + " is prime"
		else
			puts n.to_s + " is not prime"
		end
	end
end
title='2016-06-24 17:23:52 -0700'>2016-06-24tile: get rid of superfluous __GFP_REPEATMichal Hocko1-1/+1 2014-11-11tile: Use the more common pr_warn instead of pr_warningJoe Perches1-3/+1 2013-11-15tile: handle pgtable_page_ctor() failKirill A. Shutemov1-1/+5 2013-09-13tile: use pmd_pfn() instead of casting via pte_tChris Metcalf1-2/+1 2013-09-03tile: add virt_to_kpte() API and clean up and document behaviorChris Metcalf1-2/+20 2013-08-30tile: handle super huge pages in virt_to_pteChris Metcalf1-0/+3 2013-08-30tile: remove set/clear_fixmap APIsChris Metcalf1-49/+0 2013-08-13tile: avoid struct vm_struct leakChris Metcalf1-1/+1 2013-04-29mm, vmalloc: change iterating a vmlist to find_vm_area()Joonsoo Kim1-6/+1 2013-02-23swap: add per-partition lock for swapfileShaohua Li1-1/+1 2012-07-18arch/tile: tilegx PCI root complex supportChris Metcalf1-7/+0 2012-05-25arch/tile: support multiple huge page sizes dynamicallyChris Metcalf1-13/+0 2012-05-25arch/tile: Allow tilegx to build with either 16K or 64K page sizeChris Metcalf1-15/+12 2012-04-02arch/tile: fix up locking in pgtable.c slightlyChris Metcalf1-10/+12 2012-04-02arch/tile: don't set the homecache of a PTE unless appropriateChris Metcalf1-4/+12 2012-03-28Disintegrate asm/system.h for TileDavid Howells1-1/+0 2011-03-24lib, arch: add filter argument to show_mem and fix private implementationsDavid Rientjes1-1/+1 2011-03-10arch/tile: support 4KB page size as well as 64KBChris Metcalf1-29/+141 2011-02-23tile: Fix __pte_free_tlbPeter Zijlstra1-13/+2 2010-11-01arch/tile: complete migration to new kmap_atomic schemeChris Metcalf1-2/+2 2010-08-13arch: tile: mm: pgtable.c: Removed duplicated #includeAndrea Gelmini1-1/+0