login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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. 22

%I #36 May 13 2015 15:55:22

%S 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 21,36,25,41,22,39,30,48,27,46,29,49,31,52,37,59,33,56,40,64,35,60,38,

%U 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 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 This sequence is a permutation of the positive integers.

%C a(n+1)-a(n) = A175499(n).

%C 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 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 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%t a[1] = 1; d[1] = 0; k = 1; z = 10000; zz = 120;

%t A[k_] := Table[a[i], {i, 1, k}]; diff[k_] := Table[d[i], {i, 1, k}];

%t c[k_] := Complement[Range[-z, z], diff[k]];

%t T[k_] := -a[k] + Complement[Range[z], A[k]];

%t 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 u = Table[a[k], {k, 1, zz}] (* _Clark Kimberling_, May 13 2015 *)

%o (Python)

%o A175498_list, l, s, b1, b2 = [1,2], 2, 3, set(), set([1])

%o for n in range(3, 10**5):

%o ....i = s

%o ....while True:

%o ........if not (i in b1 or i-l in b2):

%o ............A175498_list.append(i)

%o ............b1.add(i)

%o ............b2.add(i-l)

%o ............l = i

%o ............while s in b1:

%o ................b1.remove(s)

%o ................s += 1

%o ............break

%o ........i += 1 # _Chai Wah Wu_, Dec 15 2014

%o (Haskell)

%o import Data.List (delete)

%o a175498 n = a175498_list !! (n-1)

%o a175498_list = 1 : f 1 [2..] [] where

%o f x zs ds = g zs where

%o g (y:ys) | diff `elem` ds = g ys

%o | otherwise = y : f y (delete y zs) (diff:ds)

%o where diff = y - x

%o -- _Reinhard Zumkeller_, Apr 25 2015

%Y Cf. A081145, A175499, A257465 (inverse), A257883, A131388, A131389, A257705.

%K nonn,nice

%O 1,2

%A _Leroy Quet_, May 31 2010

%E More terms from _Sean A. Irvine_, Jan 27 2011

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 29 08:59 EDT 2024. Contains 371268 sequences. (Running on oeis4.)