927. Prime-ary Tree

A full k-ary tree is a tree with a single root node, such that every node is either a leaf or has exactly k ordered children. The height of a k-ary tree is the number of edges in the longest path from the root to a leaf.

For instance, there is one full 3-ary tree of height 0, one full 3-ary tree of height 1, and seven full 3-ary trees of height 2. These seven are shown below.

For integers n and k with n0 and k2, define tk(n) to be the number of full k-ary trees of height n or less.
Thus, t3(0)=1, t3(1)=2, and t3(2)=9. Also, t2(0)=1, t2(1)=2, and t2(2)=5.

Define Sk to be the set of positive integers m such that m divides tk(n) for some integer n0. For instance, the above values show that 1, 2, and 5 are in S2 and 1, 2, 3, and 9 are in S3.

Let S=pSp where the intersection is taken over all primes p. Finally, define R(N) to be the sum of all elements of S not exceeding N. You are given that R(20)=18 and R(1000)=2089.

Find R(107).

927. 质数多叉树

若一棵有根树满足:其中结点要么是叶子结点、要么恰有 k 个有序的子节点,则称该树是一棵 满 k 叉树。对一棵 k 叉树,定义其 为从根节点到任意叶子结点的最长路径中的边数。

例如,高为 01 的满 3 叉树都只有 1 棵,而高为 2 的满 3 叉树有 7 棵,下图展示了这 7 棵树:

对满足 n0k2 的整数 nk,记 tk(n) 为:高 n 的满 k 叉树的数量。于是可得 t3(0)=1t3(1)=2t3(2)=9,亦可得 t2(0)=1t2(1)=2t2(2)=5

定义 Sk 为满足如下条件的正整数 m 的集合:存在整数 n0 使得 m 整除 tk(n)。例如,根据上述取值可得 1,2,5S21,2,3,9S3

S=pSp,其中下标 p 取遍全体质数。最后定义 R(N)S 中全体 N 的元素之和。已知:R(20)=18R(1000)=2089

R(107)


这个链接 回到源站。

这个链接 回到详细版题目目录。