47-smooth Triangular Numbers
A positive integer m is called p -smooth if every prime factor of m is at most p. Let T(n) = tfracn(n+1)2 denote the n -th triangular number. Determine S = sum_(n >= 1, T(n) is 47-smooth) n.
Problem Statement
This archive keeps the full statement, math, and original media on the page.
A number is \(p\)-smooth if it has no prime factors larger than \(p\).
Let \(T\) be the sequence of triangular numbers, i.e. \(T(n)=n(n+1)/2\).
Find the sum of all indices \(n\) such that \(T(n)\) is \(47\)-smooth.
Problem 581: 47-smooth Triangular Numbers
Notation and Definitions
Definition 1. Let denote the set of the first 15 primes. A positive integer is 47-smooth (equivalently, -smooth) if and only if , where is the radical of .
Mathematical Foundation
Theorem 1 (Reduction to Consecutive Smooth Pairs). For every positive integer , the triangular number is 47-smooth if and only if both and are 47-smooth.
Proof. Since , the integers and share no common prime factor. Exactly one of them is even; denote the even one by and the odd one by . Then
Since (as and share no prime factor), the prime factorization of is the multiset union of the prime factorizations of and .
Suppose is 47-smooth. Every prime dividing also divides , so . Every prime dividing also divides , so . Since , the only additional prime factor of beyond those of is . Hence both and are 47-smooth.
Suppose both and are 47-smooth. Then every prime dividing lies in . Since and division by 2 removes at most one factor of 2 (which cannot introduce new primes), is 47-smooth.
Theorem 2 (Finiteness via Stormer’s Theorem). For any finite set of primes , there exist only finitely many positive integers such that both and are -smooth.
Proof. This is a classical result due to Stormer (1897). We sketch the argument. Given consecutive -smooth integers and , set so that
Let be the squarefree part of . Since is -smooth, is a squarefree -smooth number. Write for some positive integer . Then , which is a Pell equation in with parameter .
There are only finitely many squarefree -smooth numbers (precisely ). For each such , the Pell equation has solutions forming a single recursive sequence growing exponentially. For sufficiently large solutions, will have a prime factor exceeding . Hence each Pell equation contributes at most finitely many valid pairs, and the total count is finite.
Lemma 1 (Explicit Upper Bound). Every consecutive pair of 47-smooth integers satisfies .
Proof. By exhaustive application of Stormer’s method — enumerating all Pell equation fundamental solutions for each of the squarefree 47-smooth numbers and tracking which solutions yield consecutive smooth pairs — one verifies that the largest such pair is , which satisfies .
Editorial
T(n) = n(n+1)/2 is 47-smooth iff both n and n+1 are 47-smooth (Theorem 1). By Stormer’s theorem, there are finitely many such n, all below 1.2e12. Algorithm: enumerate all 47-smooth numbers up to the bound via min-heap, then identify consecutive pairs (n, n+1) and sum the values of n.
Pseudocode
while heap is non-empty
for p in P
Complexity Analysis
Let denote the count of 47-smooth integers up to . By the Dickman—de Bruijn estimate, where and is the Dickman function. Here , giving on the order of millions.
- Time: . Each of the extractions involves a heap operation of cost and spawns at most insertions.
- Space: for the heap and the visited set.
Answer
Code
Each problem page includes the exact C++ and Python source files from the local archive.
#include <bits/stdc++.h>
using namespace std;
int main(){
// Find sum of all n such that T(n)=n(n+1)/2 is 47-smooth
// Equivalently, find consecutive 47-smooth numbers (n, n+1) and sum all n
const vector<int> primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47};
const long long LIMIT = 1200000000000LL; // Upper bound from Stormer's theorem
// Generate all 47-smooth numbers up to LIMIT using a min-heap
priority_queue<long long, vector<long long>, greater<long long>> pq;
set<long long> visited;
pq.push(1);
visited.insert(1);
long long prev = -1;
long long total = 0;
while(!pq.empty()){
long long v = pq.top();
pq.pop();
if(v > LIMIT) break;
// Check if v and prev are consecutive
if(v == prev + 1 && prev >= 1){
total += prev; // n = prev, n+1 = v
}
prev = v;
for(int p : primes){
if(v <= LIMIT / p){ // overflow check
long long nv = v * p;
if(visited.find(nv) == visited.end()){
visited.insert(nv);
pq.push(nv);
}
}
}
}
cout << total << endl;
return 0;
}
"""
Problem 581: 47-smooth Triangular Numbers
T(n) = n(n+1)/2 is 47-smooth iff both n and n+1 are 47-smooth (Theorem 1).
By Stormer's theorem, there are finitely many such n, all below 1.2e12.
Algorithm: enumerate all 47-smooth numbers up to the bound via min-heap,
then identify consecutive pairs (n, n+1) and sum the values of n.
Answer: 2227616372734
"""
import heapq
def solve():
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47]
LIMIT = 1_200_000_000_000
heap = [1]
visited = {1}
prev = -1
total = 0
while heap:
v = heapq.heappop(heap)
if v > LIMIT:
break
if v == prev + 1 and prev >= 1:
total += prev
prev = v
for p in primes:
w = v * p
if w <= LIMIT and w not in visited:
visited.add(w)
heapq.heappush(heap, w)
print(total)
solve()