

A125717


a(0)=0. a(n) = the smallest positive integer not occurring earlier in the sequence such that a(n1) is congruent to a(n) (mod n).


5



0, 1, 3, 6, 2, 7, 13, 20, 4, 22, 12, 23, 11, 24, 10, 25, 9, 26, 8, 27, 47, 5, 49, 72, 48, 73, 21, 75, 19, 77, 17, 79, 15, 81, 115, 45, 117, 43, 119, 41, 121, 39, 123, 37, 125, 35, 127, 33, 129, 31, 131, 29, 133, 80, 134, 189, 245, 74, 16, 193, 253, 70, 132, 69, 197, 67, 199, 65
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

0,3


COMMENTS

This sequence seems likely to be a permutation of the nonnegative integers.
A245340(n) = smallest m such that a(m) = n, or 1 if n never appears; see A245394 and A245395 for record values and where they occur.  Reinhard Zumkeller, Jul 21 2014
A very nice (maybe the most natural) variant of Recamán's sequence A005132.  M. F. Hasler, Nov 03 2014


LINKS

Ferenc Adorján and Reinhard Zumkeller, Table of n, a(n) for n = 0..100000 (first 10000 terms from Ferenc Adorján)
Ferenc Adorján, Some characteristics of _Leroy Quet_'s permutation sequences
Index entries for sequences related to Recamán's sequence
Index entries for sequences that are permutations of the natural numbers


MATHEMATICA

f[l_List] := Block[{n = Length[l] + 1, k = Mod[l[[ 1]], n, 1]}, While[MemberQ[l, k], k += n]; Append[l, k]]; Nest[f, {1}, 70] (*Chandler*)


PROG

(PARI) {Quet_p2(n)=/* Permutation sequence a'la Leroy Quet, A125717 */local(x=[1], k=0, w=1); for(i=2, n, if((k=x[i1]%i)==0, k=i); while(bittest(w, k1)>0, k+=i); x=concat(x, k); w+=2^(k1)); return(x)} [Ferenc Adorjan]
(Haskell)
import Data.IntMap (singleton, member, (!), insert)
a125717 n = a125717_list !! n
a125717_list = 0 : f [1..] 0 (singleton 0 0) where
f (v:vs) w m = g (reverse[wv, w2*v..1] ++ [w+v, w+2*v..]) where
g (x:xs) = if x `member` m then g xs else x : f vs x (insert x v m)
 Reinhard Zumkeller, Jul 21 2014
(PARI) A125717(n, show=0)={my(u=1, a); for(n=1, n, a%=n; while(bittest(u, a), a+=n); u+=1<<a; show&&print1(a", ")); a} \\ M. F. Hasler, Nov 03 2014


CROSSREFS

Cf. A005132.
Cf. A125715, A125718, A125725.
Cf. A245340, A245394, A245395.
Sequence in context: A072007 A078783 A273465 * A065232 A074170 A076543
Adjacent sequences: A125714 A125715 A125716 * A125718 A125719 A125720


KEYWORD

nonn,nice,look


AUTHOR

Leroy Quet, Feb 01 2007


EXTENSIONS

Extended by Ray Chandler, Feb 04 2007
a(0) added by Franklin T. AdamsWatters, Mar 31 2014


STATUS

approved



