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.

A175498 a(1)=1. a(n) = the smallest positive integer not occurring earlier such that a(n)-a(n-1) doesn't equal a(k)-a(k-1) for any k with 2 <= k <= n-1.

This page as a plain text file.
%I A175498 #39 Oct 18 2024 17:27:06
%S A175498 1,2,4,3,6,10,5,11,7,12,9,16,8,17,15,23,13,24,18,28,14,26,19,32,20,34,
%T A175498 21,36,25,41,22,39,30,48,27,46,29,49,31,52,37,59,33,56,40,64,35,60,38,
%U A175498 65,42,68,43,71,44,73,45,75,51,82,47,79,112,50,84,53,88,54,90,57,94,55,93,61,100,58,98,62,103,63,105,67
%N A175498 a(1)=1. a(n) = the smallest positive integer not occurring earlier such that a(n)-a(n-1) doesn't equal a(k)-a(k-1) for any k with 2 <= k <= n-1.
%C A175498 This sequence is a permutation of the positive integers.
%C A175498 a(n+1)-a(n) = A175499(n).
%C A175498 Conjecture: the lexicographically earliest permutation of {1,2,...n} for which differences of adjacent numbers are all distinct (cf. A131529) has, for n-->infinity, this sequence as its prefix. - _Joerg Arndt_, May 27 2012
%H A175498 Joerg Arndt and Reinhard Zumkeller, <a href="/A175498/b175498.txt">Table of n, a(n) for n = 1..10000</a>, first 1122 terms from Joerg Arndt
%H A175498 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%t A175498 a[1] = 1; d[1] = 0; k = 1; z = 10000; zz = 120;
%t A175498 A[k_] := Table[a[i], {i, 1, k}]; diff[k_] := Table[d[i], {i, 1, k}];
%t A175498 c[k_] := Complement[Range[-z, z], diff[k]];
%t A175498 T[k_] := -a[k] + Complement[Range[z], A[k]];
%t A175498 Table[{h = Min[Intersection[c[k], T[k]]], a[k + 1] = a[k] + h, d[k + 1] = h, k = k + 1}, {i, 1, zz}];
%t A175498 u = Table[a[k], {k, 1, zz}]  (* _Clark Kimberling_, May 13 2015 *)
%o A175498 (Python)
%o A175498 A175498_list, l, s, b1, b2 = [1,2], 2, 3, set(), set([1])
%o A175498 for n in range(3, 10**5):
%o A175498     i = s
%o A175498     while True:
%o A175498         if not (i in b1 or i-l in b2):
%o A175498             A175498_list.append(i)
%o A175498             b1.add(i)
%o A175498             b2.add(i-l)
%o A175498             l = i
%o A175498             while s in b1:
%o A175498                 b1.remove(s)
%o A175498                 s += 1
%o A175498             break
%o A175498         i += 1 # _Chai Wah Wu_, Dec 15 2014
%o A175498 (Haskell)
%o A175498 import Data.List (delete)
%o A175498 a175498 n = a175498_list !! (n-1)
%o A175498 a175498_list = 1 : f 1 [2..] [] where
%o A175498    f x zs ds = g zs where
%o A175498      g (y:ys) | diff `elem` ds = g ys
%o A175498               | otherwise      = y : f y (delete y zs) (diff:ds)
%o A175498               where diff = y - x
%o A175498 -- _Reinhard Zumkeller_, Apr 25 2015
%Y A175498 Cf. A081145, A175499, A257465 (inverse), A257883, A131388, A131389, A257705.
%K A175498 nonn,nice
%O A175498 1,2
%A A175498 _Leroy Quet_, May 31 2010
%E A175498 More terms from _Sean A. Irvine_, Jan 27 2011