C#,奥西里斯数(Osiris Number)的算法与源代码

1 奥西里斯数(Osiris Number)

奥西里斯数(Osiris Number)是一个数字,

其值等于通过将其自身数字的所有排列相加而形成的所有数字的值之和。

计算结果:

2 源程序

using System;

namespace Legalsoft.Truffer.Algorithm

{

/// <summary>

/// 奥西里斯数(Osiris Number)是一个数字,

/// 其值等于通过将其自身数字的所有排列相加而形成的所有数字的值之和。

/// </summary>

public static partial class Number_Sequence

{

public static bool Osiris_Number(int n)

{

int a = n % 10;

int b = (n / 10) % 10;

int c = n / 100;

int digit_sum = a + b + c;

if (n == (2 * (digit_sum) * 11))

{

return true;

}

return false;

}

}

}


POWER BY TRUFFER.CN

3 代码格式

cs 复制代码
using System;

namespace Legalsoft.Truffer.Algorithm
{
    /// <summary>
    /// 奥西里斯数(Osiris Number)是一个数字,
    /// 其值等于通过将其自身数字的所有排列相加而形成的所有数字的值之和。 
    /// </summary>
    public static partial class Number_Sequence
    {
        public static bool Osiris_Number(int n)
        {
            int a = n % 10;
            int b = (n / 10) % 10;
            int c = n / 100;
            int digit_sum = a + b + c;
            if (n == (2 * (digit_sum) * 11))
            {
                return true;
            }
            return false;
        }
    }
}
相关推荐
Js.Tx8 小时前
【具体数学 Concrete Mathematics】2.1.5 一般性的方法
算法·具体数学
暴走约伯8 小时前
【VFX工具链源码拆解 02】告别机械劳动(上):一键统改百个子粒子颜色与批量重命名
3d·unity·c#·材质
秋天的怀念_David10 小时前
算法一千零一夜 · 作品相关:版权与致谢声明
程序人生·算法·学习方法
信息安全失业大专人员10 小时前
每日了解一个智能体-WorkBuddy
开发语言·ai·c#·智能体
揽星河..10 小时前
【C语言】数组
c语言·开发语言·算法
careathers10 小时前
【数据结构】基于比较的排序算法 - 选择排序
数据结构·算法·排序算法
呆呆敲代码的小Y10 小时前
【实战精选面试题】C# 面试题详细解答,按难易程度排序
android·java·游戏·c#·游戏开发·unity面试题·c#面试题
听风若依10 小时前
C++模板初阶
c++·算法
淡海水11 小时前
09-01-内存-Unity资源生命周期全景
unity·c#·游戏引擎·.netcore·gc
纪念 22911 小时前
C++ 算法(模拟)
开发语言·c++·算法