Skip to content

Instantly share code, notes, and snippets.

@tyrcho
tyrcho / FriendNumbers.scala
Created October 14, 2013 15:41
Display the groups of friend numbers (which have the same sum of divisors)
object FriendNumbers extends App {
def sumOfDivisors(n: Int) =
(for {
i <- 1 to Math.sqrt(n).toInt
if n % i == 0
} yield i + n / i).sum
val friendGroups = (1 to 10000).groupBy(sumOfDivisors).filter(_._2.size > 1).toList.sortBy(_._1)
println(friendGroups)
}
@tyrcho
tyrcho / FriendsWithFacets.scala
Created October 14, 2013 16:25
faceted search on integers (facet : sum of divisors to search for friend numbers)
package facets
object FriendsWithFacets extends App {
type Property = Facet[Int, Int]
val sumOfDivisors = (n: Int) =>
(for {
i <- 1 to Math.sqrt(n).toInt
if n % i == 0
} yield i + n / i).sum
@tyrcho
tyrcho / README.md
Last active August 29, 2015 13:56 — forked from mbostock/.block

A basic HTML bar chart with log scale.

@tyrcho
tyrcho / index.html
Created May 21, 2014 09:02
A Pen by Michel Daviot.
<div class="contenzone">
<div class="titlebar">
<a href="aazeae">qsdqsd</a>
</div>
</div>
<div id="loggedout">
<a id="connectLink" href="#">Connect To Trello</a>
</div>
@tyrcho
tyrcho / pom.xml
Last active August 29, 2015 14:01
Hybrid project with java + scala sources
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>demo</groupId>
<artifactId>maven-scala-java</artifactId>
<version>0.0.1-SNAPSHOT</version>
<description>Hybrid project with java + scala sources</description>
<properties>
<scala.version>2.10.4</scala.version>
@tyrcho
tyrcho / Screenshots.scala
Last active August 29, 2015 14:02
mp4 video from screenshots in scala
import java.awt.GraphicsEnvironment
import java.awt.Rectangle
import java.awt.Robot
import java.awt.image.BufferedImage
import java.io.File
import java.nio.ByteBuffer
import java.util.ArrayList
import java.util.Arrays
import scala.Array.canBuildFrom
@tyrcho
tyrcho / Appart.md
Last active August 29, 2015 14:03
test.md
@tyrcho
tyrcho / longdoc.md
Created July 8, 2014 22:59
Welcome document

Welcome to StackEdit! {#welcome}

Hello, I am your first Markdown document within StackEdit[^stackedit]. Don't delete me, I can be helpful. I can be recovered anyway in the Utils tab of the Settings dialog.


Documents

@tyrcho
tyrcho / README.md
Last active February 10, 2018 11:22
Sample on how to publish a catalog or other HTML page using strapdown.js
@tyrcho
tyrcho / bl.ocks.org.md
Last active August 29, 2015 14:03
bl.ocks.org