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;
        }
    }
}
相关推荐
Q8137574601 分钟前
中阳视角下的资产配置趋势分析与算法支持
算法
yvestine8 分钟前
自然语言处理——文本表示
人工智能·python·算法·自然语言处理·文本表示
钢铁男儿28 分钟前
C# 表达式和运算符(表达式和字面量)
开发语言·c#
GalaxyPokemon37 分钟前
LeetCode - 148. 排序链表
linux·算法·leetcode
iceslime1 小时前
旅行商问题(TSP)的 C++ 动态规划解法教学攻略
数据结构·c++·算法·算法设计与分析
林鸿群1 小时前
C#子线程更新主线程UI及委托回调使用示例
开发语言·c#
o0向阳而生0o1 小时前
63、.NET 异常处理
c#·.net·异常处理
aichitang20242 小时前
矩阵详解:从基础概念到实际应用
线性代数·算法·矩阵
OpenCSG3 小时前
电子行业AI赋能软件开发经典案例——某金融软件公司
人工智能·算法·金融·开源
dfsj660113 小时前
LLMs 系列科普文(14)
人工智能·深度学习·算法