A301851 Table read by antidiagonals: T(n, k) gives the number of distinct distances on an n X k pegboard.
1, 2, 2, 3, 3, 3, 4, 5, 5, 4, 5, 7, 6, 7, 5, 6, 9, 9, 9, 9, 6, 7, 11, 12, 10, 12, 11, 7, 8, 13, 15, 14, 14, 15, 13, 8, 9, 15, 18, 17, 15, 17, 18, 15, 9, 10, 17, 21, 21, 19, 19, 21, 21, 17, 10, 11, 19, 24, 25, 24, 20, 24, 25, 24, 19, 11, 12, 21, 27, 29, 29, 26, 26, 29, 29, 27, 21, 12
Offset: 1
Examples
The 4 X 6 pegboard has 17 distinct distances: 0, 1, sqrt(2), 2, sqrt(5), sqrt(8), 3, sqrt(10), sqrt(13), 4, sqrt(17), sqrt(18), sqrt(20), 5, sqrt(26), sqrt(29), and sqrt(34). +---+---+---+---+---+---+ | * | | | | 16| 25| +---+---+---+---+---+---+ | 1 | 2 | | | 17| 26| +---+---+---+---+---+---+ | 4 | 5 | 8 | | 20| 29| +---+---+---+---+---+---+ | 9 | 10| 13| 18| | 34| +---+---+---+---+---+---+ (As depicted, the pegs are at the center of each face.) Square array begins: n\k| 1 2 3 4 5 6 7 8 ---+---------------------------------------- 1| 1 2 3 4 5 6 7 8 2| 2 3 5 7 9 11 13 15 3| 3 5 6 9 12 15 18 21 4| 4 7 9 10 14 17 21 25 5| 5 9 12 14 15 19 24 29 6| 6 11 15 17 19 20 26 31 7| 7 13 18 21 24 26 27 33 8| 8 15 21 25 29 31 33 34
Links
- Peter Kagey, Table of n, a(n) for n = 1..10000
Programs
-
Haskell
import Data.List (nub) a301851 n k = length $ nub [i^2 + j^2 | i <- [0..n-1], j <- [0..k-1]]
Comments