<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>obelisk2</author_name>
  <author_url>https://blog.hatena.ne.jp/obelisk2/</author_url>
  <blog_title>Camera Obscura</blog_title>
  <blog_url>https://obelisk.hatenablog.com/</blog_url>
  <categories>
    <anon>Ruby</anon>
    <anon>数学</anon>
  </categories>
  <description>Ruby で 10進数を n進数に直すのは int.to_s で出来ます。しかし、その逆（n進数から 10進数へ）ができるかわからなかったので、メソッドを作ってみました。ただし、n は 2 から 10 までです。アルファベットを使って、36進数まで出来ないことはないですが、とりあえず。なお、不具合があると nil を返します。 #n進数のi(String)を10進数に変換する。ただしnは2から10。 def dec(i, n) return nil if n &lt; 2 or n &gt; 10 x = 0 for j in 0..(i.length - 1) return nil unless (a …</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fobelisk.hatenablog.com%2Fentry%2F2015%2F09%2F19%2F031832&quot; title=&quot;n進数から 10進数へ（Ruby） - Camera Obscura&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2015-09-19 03:18:32</published>
  <title>n進数から 10進数へ（Ruby）</title>
  <type>rich</type>
  <url>https://obelisk.hatenablog.com/entry/2015/09/19/031832</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
