This question may be from a decade ago however since the core theme of the question is of algorithm related that is important even over such period of time I feel it is critical knowing it.
In Neutral Algorithm language let's look into the below example:
- sum ← 0
- for i ← 0 to n-1 do
- sum ← sum + 1
so, we already know primitive operations happens to exist when basic operations are computed by an algorithm.
Mainly when:
A. When arithmetic operations are performed (e.g +, -, *, etc)
B. When comparing two operands,
C. When assigning a value to variable,
D. When indexing an array with a value,
E. When calling a method,
F. When returning from a method and,
G. When following object reference.
so, when justify the above scenario with ultimate primitive operations we find that:
I. ONE basic operation when assigning to sum.
II. n+1 comparisons in the simple for loop (mind you have compared n times from 0 to n-1 and the other 1 comparison is which failed checking i < m. so total n+1 comparisons.
III. The third line sum has two primitive operations; 1 assigning to sum and another 1 performing arithmetic operations. which is since it is checked n times in the simple for loop it becomes 2*n= 2n;
IV. Last one but that is shadowed by the pseudocode is the increment which can be explicitly represented as i ← i+1 which has two primitive operation that is gone n times 2*n= 2n;
Overall the above example has a total of 1 + 1 + n + 2n + 2n = 5n+2 primitive operations
printf
is pages of code, and evenputs
is highly non-trivial once you follow it into the OS. If you don't follow it into the OS then you're computing a count of items where some items are "increment an integer" (approx one CPU cycle), and other things are "print a string to stdout" (several thousands of CPU cycles). So it's a pretty meaningless number unless you can think of something important and interesting as your definition of "primitive", and that's probably why there's not many resources about it.