tumblr見てたら
31, 331, 3331, 33331, 333331, 3333331, 33333331は素数、
333333331は素数ではない。
へぇ〜っとなるリブログがあったので、実際のトコロどんなもんか調べてみました。
確かに3が7桁の33333331までは素数で
それからは素数ではないみたいです。不思議。
333333331 は17で割れて
3333333331 は673で割れて
33333333331 は307で割れて
333333333331 は19で割れて
3333333333331 は523で割れるみたい。
一応ここまで調べてみました。
ちなみにSwift3でプログラム組んでみました。
ViewController.swift
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 |
import UIKit class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource { let aimPrime = [31, 331, 3331, 33331, 333331, 3333331, 33333331, 333333331, 3333333331, 33333333331, 333333333331, 3333333333331] var judgPrime: [String] = [] @IBOutlet weak var table: UITableView! // 素数計算 @IBAction func buttonPrimeCalc(_ sender: AnyObject) { for k in 0.. Int { return judgPrime.count } internal func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = UITableViewCell(style: UITableViewCellStyle.default, reuseIdentifier: "Cell") cell.textLabel?.text = judgPrime[indexPath.row] return cell } } |
こういうブログもありました。
- SwiftrisのサイトでiOS用のテトリスを作成中
- (Swift3)XcodeでApp installation failedと出てしまった時
- (Swift3)NSFetchRequestで型推測出来ない時の対処方法
- DroppletsとRoon.io Markdownで書けるBlogプラットフォーム
- Swift+iOSでサンプルアプリ作ってみました
人気のあるブログ:
- 新しいgemのアップデート方法(rubygems-update)
- Coda2でscssを使うときのお供にcompassをどうぞ。
- bashでUTF-8に設定して日本語表示したり使ったり。Emacsでも。
- NginxをSSL付きで動かすために設定したこと
- Macでフォルダを結合したいとき
It’s really a great and useful piece of information. I am glad that you simply
shared this useful info with us. Please keep us up to date like this.
Thanks for sharing.