A081517 Consider the smallest number m which can be expressed as the sum of n distinct numbers coprime to m. Sequence gives triangle (read by rows) of the set of coprime numbers pertaining to m. When there is a choice, use the lexicographically earliest solution.
1, 1, 2, 1, 2, 4, 1, 2, 3, 5, 1, 2, 3, 4, 7, 1, 2, 3, 4, 5, 8, 1, 2, 3, 4, 5, 6, 8, 1, 2, 3, 4, 5, 6, 7, 9, 1, 2, 3, 4, 5, 6, 7, 8, 11, 1, 2, 3, 4, 5, 6, 7, 8, 9, 14, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 19
Offset: 1
Examples
Triangle begins: 1; 1,2; 1,2,4; 1,2,3,5; 1,2,3,4,7; 1,2,3,4,5,8;
Links
- Robert Israel, Table of n, a(n) for n = 1..7260 (first 120 rows, flattened)
Programs
-
Maple
g:= proc(S,m,n) # lex-first sublist of sorted list S of size n with sum m, or FAIL option remember; local nS,i,v; nS:= nops(S); if nS < n or convert(S[1..n],`+`) > m or convert(S[-n .. -1],`+`) < m then return FAIL fi; if n = 0 then if m = 0 then return [] else return FAIL fi fi; for i from 1 to nS while S[i] <= m do v:= procname(S[i+1..-1],m-S[i],n-1); if v <> FAIL then return [S[i],op(v)] fi od; FAIL end proc: f:= proc(n) local m,v; for m from 1 do v:= g(select(t -> igcd(t,m) = 1, [$1..m]),m,n); if v <> FAIL then return op(v) fi od end proc: for n from 1 to 20 do f(n) od; # Robert Israel, Dec 22 2024
-
PARI
row(n) = {my(m=n*(n-1)/2, v); for(k=m+n, oo, v=List([1]); for(i=2, k-m, if(gcd(k, i)==1, listput(v, i))); if(#v>=n, forsubset([#v, n], w, if(sum(i=1, n, v[w[i]])==k, return(vector(n, i, v[w[i]])))))); } \\ Jinyuan Wang, May 23 2020
Extensions
More terms from R. J. Mathar, Mar 23 2007
More terms from Jinyuan Wang, May 23 2020
Comments