sptable {FunWithNumbers} | R Documentation |
Calculate the number of unique values in the cross-table of sums and products for the input set of numbers
Description
This function tests the proposition that the sum of all unique values in the cross-table of sums and products for a set of N input values is "close" to N^2 .
Usage
sptable(x)
Arguments
x |
A vector of integer values. |
Value
.
uniqsum |
vector of the unique values of the outer sum |
.
uniqprod |
vector of the unique values of the outer product |
.
spratio |
The ratio |
exponentOfN |
The (numeric) solution to N^(exponentOfN) = uniqsum+uniqprod. If Erdos is right, this will always be "close" to 2. |
Author(s)
Carl Witthoft, carl@witthoft.com
References
This conjecture is discussed in https://www.quantamagazine.org/the-sum-product-problem-shows-how-addition-and-multiplication-constrain-each-other-20190206/
Examples
(sptable(1:10))
# $uniqsum
# [1] 19
# $uniqprod
# [1] 42
# $spratio
# [1] 0.452381
# $exponentOfN
# [1] 1.78533
set.seed(42)
sptable(sample(1:100,20,rep=FALSE))
# $uniqsum
# [1] 123
# $uniqprod
# [1] 202
# $spratio
# [1] 0.6089109
# $exponentOfN
# [1] 1.930688
[Package FunWithNumbers version 1.2 Index]