Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
A249494
Lexicographically earliest permutation of the positive integers such that the parity of the first digit of a(n+1) equals that of a(n)'s last digit.
2
1, 3, 5, 7, 9, 10, 2, 4, 6, 8, 20, 21, 11, 12, 22, 23, 13, 14, 24, 25, 15, 16, 26, 27, 17, 18, 28, 29, 19, 30, 40, 41, 31, 32, 42, 43, 33, 34, 44, 45, 35, 36, 46, 47, 37, 38, 48, 49, 39, 50, 60, 61, 51, 52, 62, 63, 53, 54, 64, 65, 55, 56, 66, 67, 57, 58, 68, 69, 59, 70, 80, 81, 71, 72, 82, 83, 73, 74, 84, 85, 75, 76, 86, 87, 77, 78, 88, 89, 79, 90, 200
OFFSET
1,2
COMMENTS
See A249506 for the inverse permutation.
See A249278 (and inverse A249279) for the variant based on nonnegative integers. A162501 is a variant based not on parity but on equality.
PROG
(PARI) a(n, a=1, u=0)=for(n=1, n, for(k=1, 9e9, !bittest(u, k)&& k\10^(#Str(k)-1)==Mod(a, 2)&& !print1(a=k", ")&& break); u+=1<<a); a \\ highly unoptimized
CROSSREFS
Cf. A249506 (inverse permutation), A249278 (variant starting with 0), A249279 (inverse thereof), A162501 (variant based on equality of digits).
Cf. A000030 (initial digit), A010879 (final digit of n).
Sequence in context: A218452 A007731 A306590 * A047747 A007957 A194377
KEYWORD
nonn,base
AUTHOR
M. F. Hasler, Oct 30 2014
STATUS
approved