OFFSET
1,3
COMMENTS
A fractal sequence: If one deletes the first occurrence of 1, 2, 3, ... the original sequence is reproduced.
Subsequent runs of consecutive terms which are these first occurrences are separated by a term whose square root yields the length of the preceding run (when rounded down).
Motivated by Project Euler problem 535, see LINKS.
The sequence contains marked numbers and non-marked numbers. A number is marked if it is the first occurrence of that number.
The marked numbers are consecutive starting with a(1)=1.
Immediately preceding each non-marked number in a(n), there are exactly floor(sqrt(a(n))) [= A000196(a(n))] adjacent marked numbers.
LINKS
Martin Møller Skarbiniks Pedersen, Table of n, a(n) for n = 1..1000
Project Euler, Problem 535: Fractal Sequence
Clark Kimberling, Interspersions and Fractal Sequences Associated with Fractions c^j/d^k, Journal of Integer Sequences, Issue 5, Volume 10 (2007), Article 07.5.1
EXAMPLE
The runs of first occurrences of the positive integers are {1}, {2}, {3}, {4}, {5}, {6}, {7, 8}, {9}, {10, 11}, ... each separated from the next one by, respectively, 1, 1, 2, 1, 3, 2, 4, 1, 5, ... where 4 and 5 follow the groups {7, 8} and {10, 11} of length 2 = sqrt(4) = floor(sqrt(5)). - M. F. Hasler, Dec 13 2015
PROG
(C)
#include <stdio.h>
#include <math.h>
#define SIZE 1000
unsigned int numbers[SIZE];
int main() {
unsigned int pointer=0, next=1, circle_count=1, next_circle_number=2, sqrt_non_circle=1;
numbers[0]=1; printf("1");
while (next<SIZE) {
if (circle_count==sqrt_non_circle) {
numbers[next]=numbers[pointer]; circle_count=0; pointer++;
sqrt_non_circle=sqrt(numbers[pointer]);
} else {
circle_count++; numbers[next]=next_circle_number;
next_circle_number++;
}
printf(", %u", numbers[next]); next++;
}
}
(PARI) A265650(n, list=0, a=[1], cc=0, nc=1, p=0)={for(i=2, n, a=concat(a, if(0<=cc-=1, nc+=1, cc=sqrtint(a[!!p+p+=1]); a[p]))); list&&return(a); a[n]} \\ Set 2nd optional arg.to 1 to return the whole list. - M. F. Hasler, Dec 13 2015
CROSSREFS
KEYWORD
easy,nonn,changed
AUTHOR
Martin Møller Skarbiniks Pedersen, Dec 11 2015
EXTENSIONS
New name from M. F. Hasler, Dec 13 2015
STATUS
approved