Data update
This commit is contained in:
parent
72eb4943cb
commit
4d5544505c
2347 changed files with 62432 additions and 16731 deletions
21
Task/Factorions/EasyLang/factorions.easy
Normal file
21
Task/Factorions/EasyLang/factorions.easy
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
len fact[] 12
|
||||
arrbase fact[] 0
|
||||
#
|
||||
fact[0] = 1
|
||||
for n = 1 to 11
|
||||
fact[n] = fact[n - 1] * n
|
||||
.
|
||||
for b = 9 to 12
|
||||
write "base " & b & " factorions:"
|
||||
for i = 1 to 1500000 - 1
|
||||
sum = 0
|
||||
j = i
|
||||
while j > 0
|
||||
d = j mod b
|
||||
sum += fact[d]
|
||||
j = j div b
|
||||
.
|
||||
if sum = i : write " " & i
|
||||
.
|
||||
print ""
|
||||
.
|
||||
15
Task/Factorions/R/factorions.r
Normal file
15
Task/Factorions/R/factorions.r
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
fact_digsum <- function(n, b){
|
||||
if(n>b-1){
|
||||
return(factorial(n%%b)+fact_digsum(n%/%b, b))
|
||||
}
|
||||
else return(factorial(n))
|
||||
}
|
||||
|
||||
for(i in 9:12){
|
||||
cat("Factorions in base",i,"\n")
|
||||
for(j in 1:1499999){
|
||||
if(j==fact_digsum(j, i)){
|
||||
print(j)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue