Data update
This commit is contained in:
parent
35bcdeebf8
commit
74c69a0df6
2427 changed files with 31826 additions and 3468 deletions
26
Task/Sphenic-numbers/Sidef/sphenic-numbers.sidef
Normal file
26
Task/Sphenic-numbers/Sidef/sphenic-numbers.sidef
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
func sphenic_numbers(upto) {
|
||||
3.squarefree_almost_primes(upto)
|
||||
}
|
||||
|
||||
func sphenic_triplets(upto) {
|
||||
var S = sphenic_numbers(upto)
|
||||
S.grep_kv {|k,v| v+2 == S[k+2] }.map{ [_, _+1, _+2] }
|
||||
}
|
||||
|
||||
with (1e3) {|n|
|
||||
say "Sphenic numbers less than #{n.commify}:"
|
||||
sphenic_numbers(n-1).slices(15).each{.map{'%4s' % _}.join.say}
|
||||
}
|
||||
|
||||
with (1e4) {|n|
|
||||
say "\nSphenic triplets less than #{n.commify}:"
|
||||
sphenic_triplets(n-1).each{.say}
|
||||
}
|
||||
|
||||
with (1e6) {|n|
|
||||
var triplets = sphenic_triplets(n-1)
|
||||
say "\nThere are #{3.squarefree_almost_prime_count(n-1)} sphenic numbers less than #{n.commify}."
|
||||
say "There are #{triplets.len} sphenic triplets less than #{n.commify}."
|
||||
with (2e5) {|n| say "The #{n.commify}th sphenic number is: #{nth_squarefree_almost_prime(n, 3)}." }
|
||||
with (5e3) {|n| say "The #{n.commify}th sphenic triplet is: #{triplets[n-1]}." }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue