I have this set of values and I am trying to find a pattern or function that links p and m. If I'm given the value of p, is there a formula that can generate m?
p m
1 1
2 1
3 1
4 2
5 2
6 2
7 2
8 2
9 2
10 3
11 3
12 3
13 3
14 3
15 3
16 3
17 3
18 3
19 3
20 4
21 4
22 4
23 4
24 4
25 4
26 4
27 4
28 4
29 4
30 4
31 4
32 4
33 4
34 4
35 5
36 5
37 5
38 5
39 5
40 5
41 5
42 5
43 5
44 5
45 5
46 5
47 5
48 5
49 5
50 5
51 5
52 5
53 5
54 5
55 5
56 6
57 6
58 6
59 6
60 6
61 6
62 6
63 6
64 6
65 6
66 6
67 6
68 6
69 6
70 6
71 6
72 6
73 6
74 6
75 6
76 6
77 6
78 6
79 6
80 6
81 6
82 6
83 6
84 7
85 7
86 7
87 7
88 7
89 7
90 7
91 7
92 7
93 7
94 7
95 7
96 7
97 7
98 7
99 7
100 7
101 7
102 7
103 7
104 7
105 7
106 7
107 7
108 7
109 7
110 7
111 7
112 7
113 7
114 7
115 7
116 7
117 7
118 7
119 7
Here's what I've observed. There are 3 numbers (1-3) that produce 1, 6 numbers(4 - 9) that produce 2, 10 numbers (10 - 19), that produce 3, 15 numbers (20 - 34) that produce 4, 21 numbers (35-55) that produce 5 and so on so forth. So basically, the size of each group of numbers is increasing by triangular numbers n(n + 1) / 2. I've been thinking about it for a few hours but I can't formulate a formula that will calculate m if I'm provided with the value of p.
For more context and background to this problem, I am studying tetrahedral numbers and the value p is just any randomly selected positive integer, and the value of m is the length of a list of tetrahedral numbers ( https://www.geeksforgeeks.org/tetrahedral-numbers/ ) smaller than p. For example, when p = 5, the list of tetrahedral numbers smaller than 5 is {1, 4} and the size of that list, m = 2. When p = 40, the list = {1, 4, 10, 20, 35} and the size of that list, m = 5.

Yeah, I'm able to generate a sequence of tetrahedral numbers (and I have implemented an algorithm to do so in Java.) I'm also able to generate a sequence of tetrahedral numbers smaller than any value n. What I want to do is to be able to calculate the length of any sequence of tetrahedral numbers from 1...t, where t is smaller than some value, n.
– Kaylo Apr 15 '19 at 22:31