cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A235726 Lexicographically earliest sequence of positive integers such that a(nm) != a(n + m) for all positive integers n and m such that nm != n + m.

This page as a plain text file.
%I A235726 #52 Apr 19 2017 15:12:16
%S A235726 1,2,1,2,1,2,1,3,1,2,1,2,1,2,1,4,1,2,1,3,1,2,1,3,1,2,1,2,1,2,1,3,1,2,
%T A235726 1,4,1,2,1,3,1,2,1,2,1,2,1,3,1,2,1,3,1,2,1,3,1,2,1,2,1,2,1,5,1,2,1,2,
%U A235726 1,2,1,3,1,2,1,2,1,2,1,4,1,2,1,4,1,2,1
%N A235726 Lexicographically earliest sequence of positive integers such that a(nm) != a(n + m) for all positive integers n and m such that nm != n + m.
%C A235726 a(n) != a(n-1) because a(n*1) = a((n-1)+1).
%C A235726 Records appear at: a(1) = 1, a(2) = 2, a(8) = 3, a(16) = 4, a(64) = 5, a(1024) = 6, a(4080) = 7, a(320000) = 8.
%C A235726 From _Robert Israel_, Apr 19 2017: (Start)
%C A235726 a(n) = 1 iff n is odd.
%C A235726 If n == 2 (mod 4), then a(n) = 2.
%C A235726 (End)
%H A235726 Peter Kagey, <a href="/A235726/b235726.txt">Table of n, a(n) for n = 1..10000</a>
%e A235726 For n = 8,
%e A235726 a(8) != 1 because a(1 + 7) != a(1 * 7);
%e A235726 a(8) != 2 because a(2 * 4) != a(2 + 4);
%e A235726 a(8) = 3.
%p A235726 N:= 100: # to get a(1) to a(N)
%p A235726 A[1]:= 1: A[2]:= 2: A[3]:= 1: A[4]:= 2:
%p A235726 for n from 5 to N do
%p A235726    if n::odd then A[n]:= 1
%p A235726    else
%p A235726      A[n]:= min({$2..n} minus {seq(A[q+n/q], q=numtheory:-divisors(n) minus {1,n})});
%p A235726    fi
%p A235726 od:
%p A235726 seq(A[i],i=1..N); # _Robert Israel_, Apr 19 2017
%o A235726 (Haskell)
%o A235726 a 1 = 1
%o A235726 a 4 = 2
%o A235726 a n = head $ filter (`notElem` disallowedValues) [1..] where
%o A235726   disallowedValues = map a $ (n-1) : filter (<n) sums where
%o A235726     sums = map divisorSum divisors where
%o A235726       divisors = filter (\d -> n `mod` d == 0) [1..n]
%o A235726       divisorSum d = d + n `div` d
%Y A235726 Cf. A072670.
%K A235726 nonn
%O A235726 1,2
%A A235726 _Peter Kagey_, Apr 18 2017