2018-09-01から1ヶ月間の記事一覧

Piと序数を対応表示させてみる

<script> var arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9]; arr.forEach(function (x, y) { console.log( '['+y+ '→'+ x+ ']');}); </script>

フィボナッチ

a,b=0,1while b<10000000000000000000000000000000000000: print(b) a,b=b,a+b

フィボナッチ

11235813213455891442333776109871597258441816765109461771128657463687502512139319641831781151422983204013462692178309352457857028879227465149303522415781739088169632459861023341551655801412679142964334944377014087331134903170183631190329712…

?個ずつ分けるには

pi = ここに円周率pi2 = [pi[i: i+2] for i in range(0, len(pi), 2)]

Pi を 2個ずつ分割

['31', '41', '59', '26', '53', '58', '97', '93', '23', '84', '62', '64', '33', '83', '27', '95', '02', '88', '41', '97', '16', '93', '99', '37', '51', '05', '82', '09', '74', '94', '45', '92', '30', '78', '16', '40', '62', '86', '20', '89'…

np.reshape(arr_pi, (400, 25))

list_pi = [ここに円周率の配列] arr_pi = np.array(list_pi)xy = np.reshape(arr_pi, (400, 25)) 結果 [[1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3] [8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0] [5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 …

np.reshape(arr_pi, (200, 50))

list_pi =[円周率] arr_pi = np.array(list_pi)xy = np.reshape(arr_pi, (200, 50)) 結果 [[1 4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 3 2 7 9 5 0 2 8 8 4 1 9 7 1 6 9 3 9 9 3 7 5 1 0] [5 8 2 0 9 7 4 9 4 4 5 9 2 3 0 7 8 1 6 4 0 6 2 8 6 2…

省略なし全部表示

import numpy as npnp.set_printoptions(threshold=np.inf)

import csv

with open('data.csv', 'wt') as f: writer = csv.writer(f) writer.writerows(xy)

list of pi

[1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8, 4, 6, 2, 6, 4, 3, 3, 8, 3, 2, 7, 9, 5, 0, 2, 8, 8, 4, 1, 9, 7, 1, 6, 9, 3, 9, 9, 3, 7, 5, 1, 0, 5, 8, 2, 0, 9, 7, 4, 9, 4, 4, 5, 9, 2, 3, 0, 7, 8, 1, 6, 4, 0, 6, 2, 8, 6, 2, 0, 8, 9, 9…

list(Pi)

['1', '4', '1', '5', '9', '2', '6', '5', '3', '5', '8', '9', '7', '9', '3', '2', '3', '8', '4', '6', '2', '6', '4', '3', '3', '8', '3', '2', '7', '9', '5', '0', '2', '8', '8', '4', '1', '9', '7', '1', '6', '9', '3', '9', '9', '3', '7', '5'…

9999

素因数分解 3 * 3 * 11 * 101 約数 1, 3, 9, 11, 33, 99, 101, 303, 909, 1111, 3333, 9999

Pi 小数点以下

14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316…

ブログというか学習のメモ帳代わりです。

人工知能や人工言語に関心があり、日々研鑽しています。